From 1746577e598aab1e45140facf26ab65383e521ae Mon Sep 17 00:00:00 2001 From: MarvinJWendt Date: Thu, 21 Apr 2022 01:01:50 +0200 Subject: [PATCH] added new dir structure to examples --- _examples/area/README.md | 27 --- _examples/area/animation.svg | 10 -- _examples/area/main.go | 20 --- _examples/barchart-mixed-values/README.md | 41 ----- _examples/barchart-mixed-values/animation.svg | 10 -- _examples/barchart-mixed-values/main.go | 34 ---- _examples/barchart-negative-values/README.md | 33 ---- .../barchart-negative-values/animation.svg | 10 -- _examples/barchart-negative-values/main.go | 26 --- _examples/barchart/README.md | 33 ---- _examples/barchart/animation.svg | 10 -- _examples/barchart/main.go | 26 --- _examples/bigtext/README.md | 27 --- _examples/bigtext/animation.svg | 10 -- _examples/bigtext/main.go | 20 --- _examples/box/README.md | 25 --- _examples/box/animation.svg | 10 -- _examples/box/main.go | 18 -- _examples/bulletlist-custom/README.md | 21 --- _examples/bulletlist-custom/animation.svg | 10 -- _examples/bulletlist-custom/main.go | 14 -- _examples/bulletlist/README.md | 26 --- _examples/bulletlist/animation.svg | 10 -- _examples/bulletlist/main.go | 19 -- _examples/center/README.md | 20 --- _examples/center/animation.svg | 10 -- _examples/center/main.go | 13 -- _examples/demo/README.md | 162 ------------------ _examples/demo/animation.svg | 10 -- _examples/demo/main.go | 155 ----------------- _examples/disable-color/README.md | 162 ------------------ _examples/disable-color/animation.svg | 10 -- _examples/disable-color/main.go | 155 ----------------- _examples/disable-output/README.md | 25 --- _examples/disable-output/animation.svg | 10 -- _examples/disable-output/main.go | 18 -- _examples/disable-styling/README.md | 162 ------------------ _examples/disable-styling/animation.svg | 10 -- _examples/disable-styling/main.go | 155 ----------------- _examples/header-custom/README.md | 33 ---- _examples/header-custom/animation.svg | 10 -- _examples/header-custom/main.go | 26 --- _examples/header/README.md | 17 -- _examples/header/animation.svg | 10 -- _examples/header/main.go | 10 -- _examples/override-default-printers/README.md | 24 --- .../override-default-printers/animation.svg | 10 -- _examples/override-default-printers/main.go | 17 -- _examples/panel/README.md | 21 --- _examples/panel/animation.svg | 10 -- _examples/panel/main.go | 14 -- _examples/paragraph-custom/README.md | 24 --- _examples/paragraph-custom/animation.svg | 10 -- _examples/paragraph-custom/main.go | 17 -- _examples/paragraph/README.md | 24 --- _examples/paragraph/animation.svg | 10 -- _examples/paragraph/main.go | 17 -- _examples/prefix/README.md | 24 --- _examples/prefix/animation.svg | 10 -- _examples/prefix/main.go | 17 -- _examples/print-basic-text/README.md | 20 --- _examples/print-basic-text/animation.svg | 10 -- _examples/print-basic-text/main.go | 13 -- _examples/print-color-fade-multiple/README.md | 40 ----- .../print-color-fade-multiple/animation.svg | 10 -- _examples/print-color-fade-multiple/main.go | 33 ---- _examples/print-color-fade/README.md | 26 --- _examples/print-color-fade/animation.svg | 10 -- _examples/print-color-fade/main.go | 19 -- _examples/print-color-rgb/README.md | 18 -- _examples/print-color-rgb/animation.svg | 10 -- _examples/print-color-rgb/main.go | 11 -- _examples/print-with-color/README.md | 34 ---- _examples/print-with-color/animation.svg | 10 -- _examples/print-with-color/main.go | 27 --- _examples/progressbar/README.md | 31 ---- _examples/progressbar/animation.svg | 10 -- _examples/progressbar/main.go | 24 --- _examples/section/README.md | 22 --- _examples/section/animation.svg | 10 -- _examples/section/main.go | 15 -- _examples/spinner/README.md | 40 ----- _examples/spinner/animation.svg | 10 -- _examples/spinner/main.go | 33 ---- _examples/style/README.md | 20 --- _examples/style/animation.svg | 10 -- _examples/style/main.go | 13 -- _examples/table/README.md | 31 ---- _examples/table/animation.svg | 10 -- _examples/table/main.go | 24 --- _examples/theme/README.md | 37 ---- _examples/theme/animation.svg | 10 -- _examples/theme/main.go | 30 ---- _examples/tree/README.md | 46 ----- _examples/tree/animation.svg | 10 -- _examples/tree/main.go | 39 ----- 96 files changed, 2688 deletions(-) delete mode 100644 _examples/area/README.md delete mode 100644 _examples/area/animation.svg delete mode 100644 _examples/area/main.go delete mode 100644 _examples/barchart-mixed-values/README.md delete mode 100644 _examples/barchart-mixed-values/animation.svg delete mode 100644 _examples/barchart-mixed-values/main.go delete mode 100644 _examples/barchart-negative-values/README.md delete mode 100644 _examples/barchart-negative-values/animation.svg delete mode 100644 _examples/barchart-negative-values/main.go delete mode 100644 _examples/barchart/README.md delete mode 100644 _examples/barchart/animation.svg delete mode 100644 _examples/barchart/main.go delete mode 100644 _examples/bigtext/README.md delete mode 100644 _examples/bigtext/animation.svg delete mode 100644 _examples/bigtext/main.go delete mode 100644 _examples/box/README.md delete mode 100644 _examples/box/animation.svg delete mode 100644 _examples/box/main.go delete mode 100644 _examples/bulletlist-custom/README.md delete mode 100644 _examples/bulletlist-custom/animation.svg delete mode 100644 _examples/bulletlist-custom/main.go delete mode 100644 _examples/bulletlist/README.md delete mode 100644 _examples/bulletlist/animation.svg delete mode 100644 _examples/bulletlist/main.go delete mode 100644 _examples/center/README.md delete mode 100644 _examples/center/animation.svg delete mode 100644 _examples/center/main.go delete mode 100644 _examples/demo/README.md delete mode 100644 _examples/demo/animation.svg delete mode 100644 _examples/demo/main.go delete mode 100644 _examples/disable-color/README.md delete mode 100644 _examples/disable-color/animation.svg delete mode 100644 _examples/disable-color/main.go delete mode 100644 _examples/disable-output/README.md delete mode 100644 _examples/disable-output/animation.svg delete mode 100644 _examples/disable-output/main.go delete mode 100644 _examples/disable-styling/README.md delete mode 100644 _examples/disable-styling/animation.svg delete mode 100644 _examples/disable-styling/main.go delete mode 100644 _examples/header-custom/README.md delete mode 100644 _examples/header-custom/animation.svg delete mode 100644 _examples/header-custom/main.go delete mode 100644 _examples/header/README.md delete mode 100644 _examples/header/animation.svg delete mode 100644 _examples/header/main.go delete mode 100644 _examples/override-default-printers/README.md delete mode 100644 _examples/override-default-printers/animation.svg delete mode 100644 _examples/override-default-printers/main.go delete mode 100644 _examples/panel/README.md delete mode 100644 _examples/panel/animation.svg delete mode 100644 _examples/panel/main.go delete mode 100644 _examples/paragraph-custom/README.md delete mode 100644 _examples/paragraph-custom/animation.svg delete mode 100644 _examples/paragraph-custom/main.go delete mode 100644 _examples/paragraph/README.md delete mode 100644 _examples/paragraph/animation.svg delete mode 100644 _examples/paragraph/main.go delete mode 100644 _examples/prefix/README.md delete mode 100644 _examples/prefix/animation.svg delete mode 100644 _examples/prefix/main.go delete mode 100644 _examples/print-basic-text/README.md delete mode 100644 _examples/print-basic-text/animation.svg delete mode 100644 _examples/print-basic-text/main.go delete mode 100644 _examples/print-color-fade-multiple/README.md delete mode 100644 _examples/print-color-fade-multiple/animation.svg delete mode 100644 _examples/print-color-fade-multiple/main.go delete mode 100644 _examples/print-color-fade/README.md delete mode 100644 _examples/print-color-fade/animation.svg delete mode 100644 _examples/print-color-fade/main.go delete mode 100644 _examples/print-color-rgb/README.md delete mode 100644 _examples/print-color-rgb/animation.svg delete mode 100644 _examples/print-color-rgb/main.go delete mode 100644 _examples/print-with-color/README.md delete mode 100644 _examples/print-with-color/animation.svg delete mode 100644 _examples/print-with-color/main.go delete mode 100644 _examples/progressbar/README.md delete mode 100644 _examples/progressbar/animation.svg delete mode 100644 _examples/progressbar/main.go delete mode 100644 _examples/section/README.md delete mode 100644 _examples/section/animation.svg delete mode 100644 _examples/section/main.go delete mode 100644 _examples/spinner/README.md delete mode 100644 _examples/spinner/animation.svg delete mode 100644 _examples/spinner/main.go delete mode 100644 _examples/style/README.md delete mode 100644 _examples/style/animation.svg delete mode 100644 _examples/style/main.go delete mode 100644 _examples/table/README.md delete mode 100644 _examples/table/animation.svg delete mode 100644 _examples/table/main.go delete mode 100644 _examples/theme/README.md delete mode 100644 _examples/theme/animation.svg delete mode 100644 _examples/theme/main.go delete mode 100644 _examples/tree/README.md delete mode 100644 _examples/tree/animation.svg delete mode 100644 _examples/tree/main.go diff --git a/_examples/area/README.md b/_examples/area/README.md deleted file mode 100644 index 206827c31..000000000 --- a/_examples/area/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# area - -![Animation](animation.svg) - -```go -package main - -import ( - "time" - - "github.com/pterm/pterm" -) - -func main() { - pterm.Info.Println("The previous text will stay in place, while the area updates.") - pterm.Print("\n\n") // Add two new lines as spacer. - - area, _ := pterm.DefaultArea.WithCenter().Start() // Start the Area printer, with the Center option. - for i := 0; i < 10; i++ { - str, _ := pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString(time.Now().Format("15:04:05"))).Srender() // Save current time in str. - area.Update(str) // Update Area contents. - time.Sleep(time.Second) - } - area.Stop() -} - -``` diff --git a/_examples/area/animation.svg b/_examples/area/animation.svg deleted file mode 100644 index 31f22fae8..000000000 --- a/_examples/area/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - INFO Theprevioustextwillstayinplace,whiletheareaupdates.████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████Restartinganimation... \ No newline at end of file diff --git a/_examples/area/main.go b/_examples/area/main.go deleted file mode 100644 index 44ffb88df..000000000 --- a/_examples/area/main.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -import ( - "time" - - "github.com/pterm/pterm" -) - -func main() { - pterm.Info.Println("The previous text will stay in place, while the area updates.") - pterm.Print("\n\n") // Add two new lines as spacer. - - area, _ := pterm.DefaultArea.WithCenter().Start() // Start the Area printer, with the Center option. - for i := 0; i < 10; i++ { - str, _ := pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString(time.Now().Format("15:04:05"))).Srender() // Save current time in str. - area.Update(str) // Update Area contents. - time.Sleep(time.Second) - } - area.Stop() -} diff --git a/_examples/barchart-mixed-values/README.md b/_examples/barchart-mixed-values/README.md deleted file mode 100644 index 4f015a834..000000000 --- a/_examples/barchart-mixed-values/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# barchart-mixed-values - -![Animation](animation.svg) - -```go -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - mixedBars := pterm.Bars{ - pterm.Bar{ - Label: "Bar 1", - Value: 2, - }, - pterm.Bar{ - Label: "Bar 2", - Value: -3, - }, - pterm.Bar{ - Label: "Bar 3", - Value: -2, - }, - pterm.Bar{ - Label: "Bar 4", - Value: 5, - }, - pterm.Bar{ - Label: "Longer Label", - Value: 7, - }, - } - - pterm.DefaultSection.Println("Chart example with mixed values (note screen space usage in case when ABSOLUTE values of negative and positive parts are differ too much)") - _ = pterm.DefaultBarChart.WithBars(mixedBars).WithShowValue().Render() - _ = pterm.DefaultBarChart.WithHorizontal().WithBars(mixedBars).WithShowValue().Render() -} - -``` diff --git a/_examples/barchart-mixed-values/animation.svg b/_examples/barchart-mixed-values/animation.svg deleted file mode 100644 index 942feb6ea..000000000 --- a/_examples/barchart-mixed-values/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -#Chartexamplewithmixedvalues(notescreenspaceusageincasewhenABSOLUTEvaluesofnegativeandpositivepartsarediffertoomuch)257██████████████████-3-2Bar1Bar2Bar3Bar4LongerLabelBar1███████2Bar2███████████-3Bar3███████-2Bar4██████████████████5LongerLabel██████████████████████████7Bar4Restartinganimation... \ No newline at end of file diff --git a/_examples/barchart-mixed-values/main.go b/_examples/barchart-mixed-values/main.go deleted file mode 100644 index 10c10f91e..000000000 --- a/_examples/barchart-mixed-values/main.go +++ /dev/null @@ -1,34 +0,0 @@ -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - mixedBars := pterm.Bars{ - pterm.Bar{ - Label: "Bar 1", - Value: 2, - }, - pterm.Bar{ - Label: "Bar 2", - Value: -3, - }, - pterm.Bar{ - Label: "Bar 3", - Value: -2, - }, - pterm.Bar{ - Label: "Bar 4", - Value: 5, - }, - pterm.Bar{ - Label: "Longer Label", - Value: 7, - }, - } - - pterm.DefaultSection.Println("Chart example with mixed values (note screen space usage in case when ABSOLUTE values of negative and positive parts are differ too much)") - _ = pterm.DefaultBarChart.WithBars(mixedBars).WithShowValue().Render() - _ = pterm.DefaultBarChart.WithHorizontal().WithBars(mixedBars).WithShowValue().Render() -} diff --git a/_examples/barchart-negative-values/README.md b/_examples/barchart-negative-values/README.md deleted file mode 100644 index d790face6..000000000 --- a/_examples/barchart-negative-values/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# barchart-negative-values - -![Animation](animation.svg) - -```go -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - negativeBars := pterm.Bars{ - pterm.Bar{ - Label: "Bar 1", - Value: -5, - }, - pterm.Bar{ - Label: "Bar 2", - Value: -3, - }, - pterm.Bar{ - Label: "Longer Label", - Value: -7, - }, - } - - pterm.Info.Println("Chart example with negative only values (bars use 100% of chart area)") - _ = pterm.DefaultBarChart.WithBars(negativeBars).WithShowValue().Render() - _ = pterm.DefaultBarChart.WithHorizontal().WithBars(negativeBars).WithShowValue().Render() -} - -``` diff --git a/_examples/barchart-negative-values/animation.svg b/_examples/barchart-negative-values/animation.svg deleted file mode 100644 index a0b835d02..000000000 --- a/_examples/barchart-negative-values/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - INFO Chartexamplewithnegativeonlyvalues(barsuse100%ofchartarea)████████████-5-3-7Bar1Bar2LongerLabelBar1█████████████████████████████████████-5Bar2██████████████████████-3LongerLabel█████████████████████████████████████████████████████-7Bar1████████████████████████LongerLabel█████Restartinganimation... \ No newline at end of file diff --git a/_examples/barchart-negative-values/main.go b/_examples/barchart-negative-values/main.go deleted file mode 100644 index 94a117cdf..000000000 --- a/_examples/barchart-negative-values/main.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - negativeBars := pterm.Bars{ - pterm.Bar{ - Label: "Bar 1", - Value: -5, - }, - pterm.Bar{ - Label: "Bar 2", - Value: -3, - }, - pterm.Bar{ - Label: "Longer Label", - Value: -7, - }, - } - - pterm.Info.Println("Chart example with negative only values (bars use 100% of chart area)") - _ = pterm.DefaultBarChart.WithBars(negativeBars).WithShowValue().Render() - _ = pterm.DefaultBarChart.WithHorizontal().WithBars(negativeBars).WithShowValue().Render() -} diff --git a/_examples/barchart/README.md b/_examples/barchart/README.md deleted file mode 100644 index bbaf9280e..000000000 --- a/_examples/barchart/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# barchart - -![Animation](animation.svg) - -```go -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - positiveBars := pterm.Bars{ - pterm.Bar{ - Label: "Bar 1", - Value: 5, - }, - pterm.Bar{ - Label: "Bar 2", - Value: 3, - }, - pterm.Bar{ - Label: "Longer Label", - Value: 7, - }, - } - - pterm.Info.Println("Chart example with positive only values (bars use 100% of chart area)") - _ = pterm.DefaultBarChart.WithBars(positiveBars).Render() - _ = pterm.DefaultBarChart.WithHorizontal().WithBars(positiveBars).Render() -} - -``` diff --git a/_examples/barchart/animation.svg b/_examples/barchart/animation.svg deleted file mode 100644 index 0e6277746..000000000 --- a/_examples/barchart/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - INFO Chartexamplewithpositiveonlyvalues(barsuse100%ofchartarea)████████████Bar1Bar2LongerLabelBar1█████████████████████████████████████Bar2██████████████████████LongerLabel█████████████████████████████████████████████████████Bar1██████████████████████████LongerLabel███████Restartinganimation... \ No newline at end of file diff --git a/_examples/barchart/main.go b/_examples/barchart/main.go deleted file mode 100644 index 16aefe1e8..000000000 --- a/_examples/barchart/main.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - positiveBars := pterm.Bars{ - pterm.Bar{ - Label: "Bar 1", - Value: 5, - }, - pterm.Bar{ - Label: "Bar 2", - Value: 3, - }, - pterm.Bar{ - Label: "Longer Label", - Value: 7, - }, - } - - pterm.Info.Println("Chart example with positive only values (bars use 100% of chart area)") - _ = pterm.DefaultBarChart.WithBars(positiveBars).Render() - _ = pterm.DefaultBarChart.WithHorizontal().WithBars(positiveBars).Render() -} diff --git a/_examples/bigtext/README.md b/_examples/bigtext/README.md deleted file mode 100644 index 22615dc6d..000000000 --- a/_examples/bigtext/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# bigtext - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a large text with the LetterStyle from the standard theme. - // Useful for title screens. - pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("PTerm")).Render() - - // Print a large text with differently colored letters. - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Render() - - // NewLettersFromStringWithRGB can be used to create a large text with a specific RGB color. - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithRGB("PTerm", pterm.NewRGB(255, 215, 0))). - Render() -} - -``` diff --git a/_examples/bigtext/animation.svg b/_examples/bigtext/animation.svg deleted file mode 100644 index 9bf595cbe..000000000 --- a/_examples/bigtext/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████Restartinganimation... \ No newline at end of file diff --git a/_examples/bigtext/main.go b/_examples/bigtext/main.go deleted file mode 100644 index eff801c1d..000000000 --- a/_examples/bigtext/main.go +++ /dev/null @@ -1,20 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a large text with the LetterStyle from the standard theme. - // Useful for title screens. - pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("PTerm")).Render() - - // Print a large text with differently colored letters. - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Render() - - // NewLettersFromStringWithRGB can be used to create a large text with a specific RGB color. - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithRGB("PTerm", pterm.NewRGB(255, 215, 0))). - Render() -} diff --git a/_examples/box/README.md b/_examples/box/README.md deleted file mode 100644 index 30a758090..000000000 --- a/_examples/box/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# box - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - pterm.Info.Println("This might not be rendered correctly on GitHub,\nbut it will work in a real terminal.\nThis is because GitHub does not use a monospaced font by default for SVGs.") - - panel1 := pterm.DefaultBox.Sprint("Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore\nmagna aliqua.") - panel2 := pterm.DefaultBox.WithTitle("title").Sprint("Ut enim ad minim veniam,\nquis nostrud exercitation\nullamco laboris\nnisi ut aliquip\nex ea commodo\nconsequat.") - panel3 := pterm.DefaultBox.WithTitle("bottom center title").WithTitleBottomCenter().Sprint("Duis aute irure\ndolor in reprehenderit\nin voluptate velit esse cillum\ndolore eu fugiat\nnulla pariatur.") - - panels, _ := pterm.DefaultPanel.WithPanels(pterm.Panels{ - {{Data: panel1}, {Data: panel2}}, - {{Data: panel3}}, - }).Srender() - - pterm.DefaultBox.WithTitle("Lorem Ipsum").WithTitleBottomRight().WithRightPadding(0).WithBottomPadding(0).Println(panels) -} - -``` diff --git a/_examples/box/animation.svg b/_examples/box/animation.svg deleted file mode 100644 index 567dd52c2..000000000 --- a/_examples/box/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - INFO ThismightnotberenderedcorrectlyonGitHub, butitwillworkinarealterminal. ThisisbecauseGitHubdoesnotuseamonospacedfontbydefaultforSVGs.┌────────────────────────────────────────────────────────────────────┐|┌──────────────────────────────────┐┌─title───────────────────┐|||Loremipsumdolorsitamet,||Utenimadminimveniam,||||consecteturadipiscingelit,||quisnostrudexercitation||||seddoeiusmodtemporincididunt||ullamcolaboris||||utlaboreetdolore||nisiutaliquip||||magnaaliqua.||exeacommodo|||└──────────────────────────────────┘|consequat.|||└───────────────────────────┘||┌────────────────────────────────┐|||Duisauteirure||||dolorinreprehenderit||||involuptatevelitessecillum||||doloreeufugiat||||nullapariatur.|||└─────bottomcentertitle──────┘|||└──────────────────────────────────────────────────────LoremIpsum─┘┌────────────────────────────────────────────────|┌─────────────────|┌──────────────────────────────────┐┌─title────────────|||└─|└──────────────────────────────────|└────────────────────────|┌──────────────────────────|└──────────────────────────────────────────Restartinganimation... \ No newline at end of file diff --git a/_examples/box/main.go b/_examples/box/main.go deleted file mode 100644 index f25a80e3a..000000000 --- a/_examples/box/main.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - pterm.Info.Println("This might not be rendered correctly on GitHub,\nbut it will work in a real terminal.\nThis is because GitHub does not use a monospaced font by default for SVGs.") - - panel1 := pterm.DefaultBox.Sprint("Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore\nmagna aliqua.") - panel2 := pterm.DefaultBox.WithTitle("title").Sprint("Ut enim ad minim veniam,\nquis nostrud exercitation\nullamco laboris\nnisi ut aliquip\nex ea commodo\nconsequat.") - panel3 := pterm.DefaultBox.WithTitle("bottom center title").WithTitleBottomCenter().Sprint("Duis aute irure\ndolor in reprehenderit\nin voluptate velit esse cillum\ndolore eu fugiat\nnulla pariatur.") - - panels, _ := pterm.DefaultPanel.WithPanels(pterm.Panels{ - {{Data: panel1}, {Data: panel2}}, - {{Data: panel3}}, - }).Srender() - - pterm.DefaultBox.WithTitle("Lorem Ipsum").WithTitleBottomRight().WithRightPadding(0).WithBottomPadding(0).Println(panels) -} diff --git a/_examples/bulletlist-custom/README.md b/_examples/bulletlist-custom/README.md deleted file mode 100644 index 9b9b6c5c4..000000000 --- a/_examples/bulletlist-custom/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# bulletlist-custom - -![Animation](animation.svg) - -```go -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - // Print a customized list with different styles and levels. - pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ - {Level: 0, Text: "Blue", TextStyle: pterm.NewStyle(pterm.FgBlue), BulletStyle: pterm.NewStyle(pterm.FgRed)}, - {Level: 1, Text: "Green", TextStyle: pterm.NewStyle(pterm.FgGreen), Bullet: "-", BulletStyle: pterm.NewStyle(pterm.FgLightWhite)}, - {Level: 2, Text: "Cyan", TextStyle: pterm.NewStyle(pterm.FgCyan), Bullet: ">", BulletStyle: pterm.NewStyle(pterm.FgYellow)}, - }).Render() -} - -``` diff --git a/_examples/bulletlist-custom/animation.svg b/_examples/bulletlist-custom/animation.svg deleted file mode 100644 index 70ecb687e..000000000 --- a/_examples/bulletlist-custom/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Blue-Green>CyanRestartinganimation... \ No newline at end of file diff --git a/_examples/bulletlist-custom/main.go b/_examples/bulletlist-custom/main.go deleted file mode 100644 index 75c90a311..000000000 --- a/_examples/bulletlist-custom/main.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - // Print a customized list with different styles and levels. - pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ - {Level: 0, Text: "Blue", TextStyle: pterm.NewStyle(pterm.FgBlue), BulletStyle: pterm.NewStyle(pterm.FgRed)}, - {Level: 1, Text: "Green", TextStyle: pterm.NewStyle(pterm.FgGreen), Bullet: "-", BulletStyle: pterm.NewStyle(pterm.FgLightWhite)}, - {Level: 2, Text: "Cyan", TextStyle: pterm.NewStyle(pterm.FgCyan), Bullet: ">", BulletStyle: pterm.NewStyle(pterm.FgYellow)}, - }).Render() -} diff --git a/_examples/bulletlist/README.md b/_examples/bulletlist/README.md deleted file mode 100644 index ea6634eaa..000000000 --- a/_examples/bulletlist/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# bulletlist - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a list with different levels. - // Useful to generate lists automatically from data. - pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ - {Level: 0, Text: "Level 0"}, - {Level: 1, Text: "Level 1"}, - {Level: 2, Text: "Level 2"}, - }).Render() - - // Convert a text to a list and print it. - pterm.NewBulletListFromString(`0 - 1 - 2 - 3`, " ").Render() -} - -``` diff --git a/_examples/bulletlist/animation.svg b/_examples/bulletlist/animation.svg deleted file mode 100644 index fb28094d6..000000000 --- a/_examples/bulletlist/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Level0Level1Level20123Restartinganimation... \ No newline at end of file diff --git a/_examples/bulletlist/main.go b/_examples/bulletlist/main.go deleted file mode 100644 index ef3b781c4..000000000 --- a/_examples/bulletlist/main.go +++ /dev/null @@ -1,19 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a list with different levels. - // Useful to generate lists automatically from data. - pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ - {Level: 0, Text: "Level 0"}, - {Level: 1, Text: "Level 1"}, - {Level: 2, Text: "Level 2"}, - }).Render() - - // Convert a text to a list and print it. - pterm.NewBulletListFromString(`0 - 1 - 2 - 3`, " ").Render() -} diff --git a/_examples/center/README.md b/_examples/center/README.md deleted file mode 100644 index 0d2ad2403..000000000 --- a/_examples/center/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# center - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - pterm.DefaultCenter.Println("This text is centered!\nIt centeres the whole block by default.\nIn that way you can do stuff like this:") - - // Generate BigLetters - s, _ := pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("PTerm")).Srender() - pterm.DefaultCenter.Println(s) // Print BigLetters with the default CenterPrinter - - pterm.DefaultCenter.WithCenterEachLineSeparately().Println("This text is centered!\nBut each line is\ncentered\nseparately") -} - -``` diff --git a/_examples/center/animation.svg b/_examples/center/animation.svg deleted file mode 100644 index db8236664..000000000 --- a/_examples/center/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Thistextiscentered!Itcenteresthewholeblockbydefault.Inthatwayyoucandostufflikethis:███████████████████████████████████████████████████████████████████████████████████████████████████████████████████Thistextiscentered!ButeachlineiscenteredseparatelyRestartinganimation... \ No newline at end of file diff --git a/_examples/center/main.go b/_examples/center/main.go deleted file mode 100644 index 9c879169c..000000000 --- a/_examples/center/main.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - pterm.DefaultCenter.Println("This text is centered!\nIt centeres the whole block by default.\nIn that way you can do stuff like this:") - - // Generate BigLetters - s, _ := pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("PTerm")).Srender() - pterm.DefaultCenter.Println(s) // Print BigLetters with the default CenterPrinter - - pterm.DefaultCenter.WithCenterEachLineSeparately().Println("This text is centered!\nBut each line is\ncentered\nseparately") -} diff --git a/_examples/demo/README.md b/_examples/demo/README.md deleted file mode 100644 index 4738b2e1f..000000000 --- a/_examples/demo/README.md +++ /dev/null @@ -1,162 +0,0 @@ -# demo - -![Animation](animation.svg) - -```go -package main - -import ( - "math/rand" - "strconv" - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Change this to time.Millisecond*200 to speed up the demo. -// Useful when debugging. -const second = time.Second - -var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - introScreen() - clear() - pseudoApplicationHeader() - time.Sleep(second) - installingPseudoList() - time.Sleep(second * 2) - pterm.DefaultSection.WithLevel(2).Println("Program Install Report") - installedProgramsSize() - time.Sleep(second * 4) - pterm.DefaultSection.Println("Tree Printer") - installedTree() - time.Sleep(second * 4) - pterm.DefaultSection.Println("TrueColor Support") - fadeText() - time.Sleep(second) - pterm.DefaultSection.Println("Bullet List Printer") - listPrinter() -} - -func installedTree() { - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Go"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - } - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s}) - } - if s == "pseudo-chrome" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"}) - } - } - - pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render() -} - -func installingPseudoList() { - pterm.DefaultSection.Println("Installing pseudo programs") - - p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start() - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Installing " + pseudoProgramList[i]) - if pseudoProgramList[i] == "pseudo-minecraft" { - pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.") - } else { - pterm.Success.Println("Installing " + pseudoProgramList[i]) - p.Increment() - } - time.Sleep(second / 2) - } - p.Stop() -} - -func listPrinter() { - pterm.NewBulletListFromString(`Good bye - Have a nice day!`, " ").Render() -} - -func fadeText() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - - str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)" - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - pterm.Info.Println(fadeInfo) -} - -func installedProgramsSize() { - d := pterm.TableData{{"Program Name", "Status", "Size"}} - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"}) - } else { - d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"}) - } - } - pterm.DefaultTable.WithHasHeader().WithData(d).Render() -} - -func pseudoApplicationHeader() *pterm.TextPrinter { - return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "Pseudo Application created with PTerm") -} - -func introScreen() { - ptermLogo, _ := pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Srender() - - pterm.DefaultCenter.Print(ptermLogo) - - pterm.DefaultCenter.Print(pterm.DefaultHeader.WithFullWidth().WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Sprint("PTDP - PTerm Demo Program")) - - pterm.Info.Println("This animation was generated with the latest version of PTerm!" + - "\nPTerm works on nearly every terminal and operating system." + - "\nIt's super easy to use!" + - "\nIf you want, you can customize everything :)" + - "\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." + - "\n" + - "\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST"))) - pterm.Println() - introSpinner, _ := pterm.DefaultSpinner.WithShowTimer(false).WithRemoveWhenDone(true).Start("Waiting for 15 seconds...") - time.Sleep(second) - for i := 14; i > 0; i-- { - if i > 1 { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...") - } else { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...") - } - time.Sleep(second) - } - introSpinner.Stop() -} - -func clear() { - print("\033[H\033[2J") -} - -func randomInt(min, max int) int { - rand.Seed(time.Now().UnixNano()) - return rand.Intn(max-min+1) + min -} - -``` diff --git a/_examples/demo/animation.svg b/_examples/demo/animation.svg deleted file mode 100644 index 0d5afe5e2..000000000 --- a/_examples/demo/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -███████████████████████████████████████████████████████████████████████████████████████████████████████████████████ PTDP - PTerm Demo Program INFO ThisanimationwasgeneratedwiththelatestversionofPTerm! PTermworksonnearlyeveryterminalandoperatingsystem. It'ssupereasytouse! Ifyouwant,youcancustomizeeverything:) Youcanseethecodeofthisdemointhe./_examples/demodirectory. Thisdemowasupdatedat:20Apr2022-22:18:04UTCWaitingfor15seconds...Waitingfor14seconds...Waitingfor14seconds...Waitingfor13seconds...Waitingfor13seconds...Waitingfor12seconds...Waitingfor12seconds...Waitingfor11seconds...Waitingfor11seconds...Waitingfor10seconds...Waitingfor10seconds...Waitingfor9seconds...Waitingfor9seconds...Waitingfor8seconds...Waitingfor8seconds...Waitingfor7seconds...Waitingfor7seconds...Waitingfor6seconds...Waitingfor6seconds...Waitingfor5seconds...Waitingfor5seconds...Waitingfor4seconds...Waitingfor4seconds...Waitingfor3seconds...Waitingfor3seconds...Waitingfor2seconds...Waitingfor2seconds...Waitingfor1second...Waitingfor1second... Pseudo Application created with PTerm #Installingpseudoprograms SUCCESS Installingpseudo-excel SUCCESS Installingpseudo-photoshop SUCCESS Installingpseudo-chrome SUCCESS Installingpseudo-outlook SUCCESS Installingpseudo-explorer SUCCESS Installingpseudo-dops SUCCESS Installingpseudo-git SUCCESS Installingpseudo-vsc SUCCESS Installingpseudo-intellij WARNING Couldnotinstallpseudo-minecraft Thecompanypolicyforbidsgames. SUCCESS Installingpseudo-scoop SUCCESS Installingpseudo-chocolateyInstallingpseudo-chocolatey[11/12]███████████████████████████████░░░92%|6s##ProgramInstallReportProgramName|Status|Sizepseudo-excel|pass|193mbpseudo-photoshop|pass|85mbpseudo-chrome|pass|181mbpseudo-outlook|pass|14mbpseudo-explorer|pass|106mbpseudo-dops|pass|183mbpseudo-git|pass|143mbpseudo-vsc|pass|53mbpseudo-intellij|pass|102mbpseudo-minecraft|fail|0mbpseudo-scoop|pass|46mbpseudo-chocolatey|pass|131mb#TreePrinter└─┬C:├──Go├──Windows└─┬Programs├──pseudo-excel├──pseudo-photoshop├─┬pseudo-chrome├──pseudo-Tabs├─┬pseudo-Extensions├──RefinedGitHub└──GitHubDarkTheme└─┬pseudo-Bookmarks└──PTerm├──pseudo-outlook├──pseudo-explorer├──pseudo-dops├──pseudo-git├──pseudo-vsc├──pseudo-intellij├──pseudo-scoop└──pseudo-chocolatey#TrueColorSupport INFO IfyourterminalhasTrueColorsupport,youcanuseRGBcolors! Youcanevenfadethem:)#BulletListPrinterGoodbyeHaveaniceday!Waitingfor15seconds...Waitingfor15seconds...Waitingfor15seconds...Waitingfor14seconds...Waitingfor14seconds...Waitingfor13seconds...Waitingfor13seconds...Waitingfor12seconds...Waitingfor12seconds...Waitingfor11seconds...Waitingfor11seconds...Waitingfor10seconds...Waitingfor10seconds...Waitingfor9seconds...Waitingfor9seconds...Waitingfor8seconds...Waitingfor8seconds...Waitingfor7seconds...Waitingfor7seconds...Waitingfor6seconds...Waitingfor6seconds...Waitingfor5seconds...Waitingfor5seconds...Waitingfor4seconds...Waitingfor4seconds...Waitingfor3seconds...Waitingfor3seconds...Waitingfor2seconds...Waitingfor2seconds...Waitingfor1second...Waitingfor1second...Installingpseudo-excel[1/12]████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░8%|0sInstallingpseudo-photoshop[2/12]██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░17%|1sInstallingpseudo-chrome[3/12]██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░25%|1sInstallingpseudo-outlook[4/12]█████████████░░░░░░░░░░░░░░░░░░░░░░░░░33%|2sInstallingpseudo-explorer[5/12]████████████████░░░░░░░░░░░░░░░░░░░░░42%|2sInstallingpseudo-dops[5/12]█████████████████░░░░░░░░░░░░░░░░░░░░░░░░42%|3sInstallingpseudo-dops[6/12]█████████████████████░░░░░░░░░░░░░░░░░░░░50%|3sInstallingpseudo-git[6/12]█████████████████████░░░░░░░░░░░░░░░░░░░░░50%|3sInstallingpseudo-git[7/12]████████████████████████░░░░░░░░░░░░░░░░░░58%|3sInstallingpseudo-vsc[7/12]████████████████████████░░░░░░░░░░░░░░░░░░58%|4sInstallingpseudo-vsc[8/12]████████████████████████████░░░░░░░░░░░░░░67%|4sInstallingpseudo-intellij[9/12]████████████████████████████░░░░░░░░░75%|4sInstallingpseudo-minecraft[9/12]███████████████████████████░░░░░░░░░75%|5sInstallingpseudo-scoop[10/12]████████████████████████████████░░░░░░░83%|5sInstallingpseudo-chocolatey[10/12]████████████████████████████░░░░░░83%|6spseudo-outlook|pass|pse├── INFO IfyourterminalhasTrueColorsupp YoucRestartinganimation... \ No newline at end of file diff --git a/_examples/demo/main.go b/_examples/demo/main.go deleted file mode 100644 index 6017a5587..000000000 --- a/_examples/demo/main.go +++ /dev/null @@ -1,155 +0,0 @@ -package main - -import ( - "math/rand" - "strconv" - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Change this to time.Millisecond*200 to speed up the demo. -// Useful when debugging. -const second = time.Second - -var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - introScreen() - clear() - pseudoApplicationHeader() - time.Sleep(second) - installingPseudoList() - time.Sleep(second * 2) - pterm.DefaultSection.WithLevel(2).Println("Program Install Report") - installedProgramsSize() - time.Sleep(second * 4) - pterm.DefaultSection.Println("Tree Printer") - installedTree() - time.Sleep(second * 4) - pterm.DefaultSection.Println("TrueColor Support") - fadeText() - time.Sleep(second) - pterm.DefaultSection.Println("Bullet List Printer") - listPrinter() -} - -func installedTree() { - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Go"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - } - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s}) - } - if s == "pseudo-chrome" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"}) - } - } - - pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render() -} - -func installingPseudoList() { - pterm.DefaultSection.Println("Installing pseudo programs") - - p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start() - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Installing " + pseudoProgramList[i]) - if pseudoProgramList[i] == "pseudo-minecraft" { - pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.") - } else { - pterm.Success.Println("Installing " + pseudoProgramList[i]) - p.Increment() - } - time.Sleep(second / 2) - } - p.Stop() -} - -func listPrinter() { - pterm.NewBulletListFromString(`Good bye - Have a nice day!`, " ").Render() -} - -func fadeText() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - - str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)" - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - pterm.Info.Println(fadeInfo) -} - -func installedProgramsSize() { - d := pterm.TableData{{"Program Name", "Status", "Size"}} - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"}) - } else { - d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"}) - } - } - pterm.DefaultTable.WithHasHeader().WithData(d).Render() -} - -func pseudoApplicationHeader() *pterm.TextPrinter { - return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "Pseudo Application created with PTerm") -} - -func introScreen() { - ptermLogo, _ := pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Srender() - - pterm.DefaultCenter.Print(ptermLogo) - - pterm.DefaultCenter.Print(pterm.DefaultHeader.WithFullWidth().WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Sprint("PTDP - PTerm Demo Program")) - - pterm.Info.Println("This animation was generated with the latest version of PTerm!" + - "\nPTerm works on nearly every terminal and operating system." + - "\nIt's super easy to use!" + - "\nIf you want, you can customize everything :)" + - "\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." + - "\n" + - "\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST"))) - pterm.Println() - introSpinner, _ := pterm.DefaultSpinner.WithShowTimer(false).WithRemoveWhenDone(true).Start("Waiting for 15 seconds...") - time.Sleep(second) - for i := 14; i > 0; i-- { - if i > 1 { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...") - } else { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...") - } - time.Sleep(second) - } - introSpinner.Stop() -} - -func clear() { - print("\033[H\033[2J") -} - -func randomInt(min, max int) int { - rand.Seed(time.Now().UnixNano()) - return rand.Intn(max-min+1) + min -} diff --git a/_examples/disable-color/README.md b/_examples/disable-color/README.md deleted file mode 100644 index 39561cc55..000000000 --- a/_examples/disable-color/README.md +++ /dev/null @@ -1,162 +0,0 @@ -# disable-color - -![Animation](animation.svg) - -```go -package main - -import ( - "math/rand" - "strconv" - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Change this to time.Millisecond*200 to speed up the demo. -// Useful when debugging. -const second = time.Second - -var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - pterm.DisableColor() - introScreen() - clear() - pseudoApplicationHeader() - time.Sleep(second) - installingPseudoList() - time.Sleep(second * 2) - pterm.DefaultSection.WithLevel(2).Println("Program Install Report") - installedProgramsSize() - time.Sleep(second * 4) - pterm.DefaultSection.Println("Tree Printer") - installedTree() - time.Sleep(second * 4) - pterm.DefaultSection.Println("TrueColor Support") - fadeText() - time.Sleep(second) - pterm.DefaultSection.Println("Bullet List Printer") - listPrinter() -} - -func installedTree() { - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Go"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - } - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s}) - } - if s == "pseudo-chrome" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"}) - } - } - - pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render() -} - -func installingPseudoList() { - pterm.DefaultSection.Println("Installing pseudo programs") - - p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start() - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Installing " + pseudoProgramList[i]) - if pseudoProgramList[i] == "pseudo-minecraft" { - pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.") - } else { - pterm.Success.Println("Installing " + pseudoProgramList[i]) - p.Increment() - } - time.Sleep(second / 2) - } - p.Stop() -} - -func listPrinter() { - pterm.NewBulletListFromString(`Good bye - Have a nice day!`, " ").Render() -} - -func fadeText() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - - str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)" - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - pterm.Info.Println(fadeInfo) -} - -func installedProgramsSize() { - d := pterm.TableData{{"Program Name", "Status", "Size"}} - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"}) - } else { - d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"}) - } - } - pterm.DefaultTable.WithHasHeader().WithData(d).Render() -} - -func pseudoApplicationHeader() *pterm.TextPrinter { - return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "Pseudo Application created with PTerm") -} - -func introScreen() { - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Render() - - pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "PTDP - PTerm Demo Program") - - pterm.Info.Println("This animation was generated with the latest version of PTerm!" + - "\nPTerm works on nearly every terminal and operating system." + - "\nIt's super easy to use!" + - "\nIf you want, you can customize everything :)" + - "\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." + - "\n" + - "\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST"))) - pterm.Println() - introSpinner, _ := pterm.DefaultSpinner.WithRemoveWhenDone(true).Start("Waiting for 15 seconds...") - time.Sleep(second) - for i := 14; i > 0; i-- { - if i > 1 { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...") - } else { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...") - } - time.Sleep(second) - } - introSpinner.Stop() -} - -func clear() { - print("\033[H\033[2J") -} - -func randomInt(min, max int) int { - rand.Seed(time.Now().UnixNano()) - return rand.Intn(max-min+1) + min -} - -``` diff --git a/_examples/disable-color/animation.svg b/_examples/disable-color/animation.svg deleted file mode 100644 index b69178f94..000000000 --- a/_examples/disable-color/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -███████████████████████████████████████████████████████████████████████████████████████████████████████████████████PTDP-PTermDemoProgramINFOThisanimationwasgeneratedwiththelatestversionofPTerm!PTermworksonnearlyeveryterminalandoperatingsystem.It'ssupereasytouse!Ifyouwant,youcancustomizeeverything:)Youcanseethecodeofthisdemointhe./_examples/demodirectory.Thisdemowasupdatedat:20Apr2022-22:18:43UTCPseudoApplicationcreatedwithPTerm#InstallingpseudoprogramsSUCCESSInstallingpseudo-excelSUCCESSInstallingpseudo-photoshopSUCCESSInstallingpseudo-chromeSUCCESSInstallingpseudo-outlookSUCCESSInstallingpseudo-explorerSUCCESSInstallingpseudo-dopsSUCCESSInstallingpseudo-gitSUCCESSInstallingpseudo-vscSUCCESSInstallingpseudo-intellijWARNINGCouldnotinstallpseudo-minecraftThecompanypolicyforbidsgames.SUCCESSInstallingpseudo-scoopSUCCESSInstallingpseudo-chocolateyInstallingpseudo-chocolatey[11/12]███████████████████████████████░░░92%|6s##ProgramInstallReportProgramName|Status|Sizepseudo-excel|pass|18mbpseudo-photoshop|pass|48mbpseudo-chrome|pass|113mbpseudo-outlook|pass|78mbpseudo-explorer|pass|176mbpseudo-dops|pass|140mbpseudo-git|pass|26mbpseudo-vsc|pass|63mbpseudo-intellij|pass|147mbpseudo-minecraft|fail|0mbpseudo-scoop|pass|15mbpseudo-chocolatey|pass|62mb├──pseudo-excel├──pseudo-photoshop├─┬pseudo-chrome├──pseudo-Tabs├─┬pseudo-Extensions├──RefinedGitHub└──GitHubDarkTheme└─┬pseudo-Bookmarks└──PTerm├──pseudo-outlook├──pseudo-explorer├──pseudo-dops├──pseudo-git├──pseudo-vsc├──pseudo-intellij├──pseudo-scoop└──pseudo-chocolatey#TrueColorSupportINFOIfyourterminalhasTrueColorsupport,youcanuseRGBcolors!Youcanevenfadethem:)#BulletListPrinterGoodbyeHaveaniceday!Waitingfor15seconds...(0s)Waitingfor15seconds...(0s)Waitingfor15seconds...(0s)Waitingfor15seconds...(1s)Waitingfor15seconds...(1s)Waitingfor14seconds...Waitingfor14seconds...(1s)Waitingfor14seconds...(1s)Waitingfor14seconds...(1s)Waitingfor14seconds...(2s)Waitingfor14seconds...(2s)Waitingfor13seconds...Waitingfor13seconds...(2s)Waitingfor13seconds...(2s)Waitingfor13seconds...(2s)Waitingfor13seconds...(3s)Waitingfor13seconds...(3s)Waitingfor12seconds...Waitingfor12seconds...(3s)Waitingfor12seconds...(3s)Waitingfor12seconds...(3s)Waitingfor12seconds...(4s)Waitingfor12seconds...(4s)Waitingfor11seconds...Waitingfor11seconds...(4s)Waitingfor11seconds...(4s)Waitingfor11seconds...(4s)Waitingfor11seconds...(5s)Waitingfor11seconds...(5s)Waitingfor10seconds...Waitingfor10seconds...(5s)Waitingfor10seconds...(5s)Waitingfor10seconds...(5s)Waitingfor10seconds...(6s)Waitingfor10seconds...(6s)Waitingfor9seconds...Waitingfor9seconds...(6s)Waitingfor9seconds...(6s)Waitingfor9seconds...(6s)Waitingfor9seconds...(7s)Waitingfor9seconds...(7s)Waitingfor8seconds...Waitingfor8seconds...(7s)Waitingfor8seconds...(7s)Waitingfor8seconds...(7s)Waitingfor8seconds...(8s)Waitingfor8seconds...(8s)Waitingfor7seconds...Waitingfor7seconds...(8s)Waitingfor7seconds...(8s)Waitingfor7seconds...(8s)Waitingfor7seconds...(9s)Waitingfor7seconds...(9s)Waitingfor6seconds...Waitingfor6seconds...(9s)Waitingfor6seconds...(9s)Waitingfor6seconds...(9s)Waitingfor6seconds...(10s)Waitingfor6seconds...(10s)Waitingfor5seconds...Waitingfor5seconds...(10s)Waitingfor5seconds...(10s)Waitingfor5seconds...(10s)Waitingfor5seconds...(11s)Waitingfor5seconds...(11s)Waitingfor4seconds...Waitingfor4seconds...(11s)Waitingfor4seconds...(11s)Waitingfor4seconds...(11s)Waitingfor4seconds...(12s)Waitingfor4seconds...(12s)Waitingfor3seconds...Waitingfor3seconds...(12s)Waitingfor3seconds...(12s)Waitingfor3seconds...(12s)Waitingfor3seconds...(13s)Waitingfor3seconds...(13s)Waitingfor2seconds...Waitingfor2seconds...(13s)Waitingfor2seconds...(13s)Waitingfor2seconds...(13s)Waitingfor2seconds...(14s)Waitingfor2seconds...(14s)Waitingfor1second...Waitingfor1second...(14s)Waitingfor1second...(14s)Waitingfor1second...(14s)Waitingfor1second...(15s)Waitingfor1second...(15s)Installingstuff[0/12]0%|0sInstallingpseudo-excel[1/12]████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░8%|0sInstallingpseudo-photoshop[1/12]████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░8%|1sInstallingpseudo-photoshop[2/12]██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░17%|1sInstallingpseudo-chrome[3/12]██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░25%|1sInstallingpseudo-outlook[4/12]█████████████░░░░░░░░░░░░░░░░░░░░░░░░░33%|2sInstallingpseudo-explorer[5/12]████████████████░░░░░░░░░░░░░░░░░░░░░42%|2sInstallingpseudo-dops[6/12]█████████████████████░░░░░░░░░░░░░░░░░░░░50%|3sInstallingpseudo-git[6/12]█████████████████████░░░░░░░░░░░░░░░░░░░░░50%|3sInstallingpseudo-git[7/12]████████████████████████░░░░░░░░░░░░░░░░░░58%|3sInstallingpseudo-vsc[8/12]████████████████████████████░░░░░░░░░░░░░░67%|4sInstallingpseudo-intellij[8/12]█████████████████████████░░░░░░░░░░░░67%|4sInstallingpseudo-intellij[9/12]████████████████████████████░░░░░░░░░75%|4sInstallingpseudo-minecraft[9/12]███████████████████████████░░░░░░░░░75%|5sInstallingpseudo-scoop[9/12]██████████████████████████████░░░░░░░░░░75%|5sInstallingpseudo-scoop[10/12]████████████████████████████████░░░░░░░83%|5sInstallingpseudo-chocolatey[10/12]████████████████████████████░░░░░░83%|6s#TreePrinter└─┬C:├──Go├──Windows└─┬ProgramsRestartinganimation... \ No newline at end of file diff --git a/_examples/disable-color/main.go b/_examples/disable-color/main.go deleted file mode 100644 index 02f24ad53..000000000 --- a/_examples/disable-color/main.go +++ /dev/null @@ -1,155 +0,0 @@ -package main - -import ( - "math/rand" - "strconv" - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Change this to time.Millisecond*200 to speed up the demo. -// Useful when debugging. -const second = time.Second - -var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - pterm.DisableColor() - introScreen() - clear() - pseudoApplicationHeader() - time.Sleep(second) - installingPseudoList() - time.Sleep(second * 2) - pterm.DefaultSection.WithLevel(2).Println("Program Install Report") - installedProgramsSize() - time.Sleep(second * 4) - pterm.DefaultSection.Println("Tree Printer") - installedTree() - time.Sleep(second * 4) - pterm.DefaultSection.Println("TrueColor Support") - fadeText() - time.Sleep(second) - pterm.DefaultSection.Println("Bullet List Printer") - listPrinter() -} - -func installedTree() { - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Go"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - } - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s}) - } - if s == "pseudo-chrome" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"}) - } - } - - pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render() -} - -func installingPseudoList() { - pterm.DefaultSection.Println("Installing pseudo programs") - - p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start() - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Installing " + pseudoProgramList[i]) - if pseudoProgramList[i] == "pseudo-minecraft" { - pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.") - } else { - pterm.Success.Println("Installing " + pseudoProgramList[i]) - p.Increment() - } - time.Sleep(second / 2) - } - p.Stop() -} - -func listPrinter() { - pterm.NewBulletListFromString(`Good bye - Have a nice day!`, " ").Render() -} - -func fadeText() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - - str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)" - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - pterm.Info.Println(fadeInfo) -} - -func installedProgramsSize() { - d := pterm.TableData{{"Program Name", "Status", "Size"}} - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"}) - } else { - d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"}) - } - } - pterm.DefaultTable.WithHasHeader().WithData(d).Render() -} - -func pseudoApplicationHeader() *pterm.TextPrinter { - return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "Pseudo Application created with PTerm") -} - -func introScreen() { - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Render() - - pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "PTDP - PTerm Demo Program") - - pterm.Info.Println("This animation was generated with the latest version of PTerm!" + - "\nPTerm works on nearly every terminal and operating system." + - "\nIt's super easy to use!" + - "\nIf you want, you can customize everything :)" + - "\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." + - "\n" + - "\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST"))) - pterm.Println() - introSpinner, _ := pterm.DefaultSpinner.WithRemoveWhenDone(true).Start("Waiting for 15 seconds...") - time.Sleep(second) - for i := 14; i > 0; i-- { - if i > 1 { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...") - } else { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...") - } - time.Sleep(second) - } - introSpinner.Stop() -} - -func clear() { - print("\033[H\033[2J") -} - -func randomInt(min, max int) int { - rand.Seed(time.Now().UnixNano()) - return rand.Intn(max-min+1) + min -} diff --git a/_examples/disable-output/README.md b/_examples/disable-output/README.md deleted file mode 100644 index 5adec41d5..000000000 --- a/_examples/disable-output/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# disable-output - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - for i := 0; i < 15; i++ { - switch i { - case 5: - pterm.Info.Println("Disabled Output!") - pterm.DisableOutput() - case 10: - pterm.EnableOutput() - pterm.Info.Println("Enabled Output!") - } - - pterm.Printf("Printing something... [%d/%d]\n", i, 15) - } -} - -``` diff --git a/_examples/disable-output/animation.svg b/_examples/disable-output/animation.svg deleted file mode 100644 index 02bb83af8..000000000 --- a/_examples/disable-output/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Printingsomething...[0/15]Printingsomething...[1/15]Printingsomething...[2/15]Printingsomething...[3/15]Printingsomething...[4/15] INFO DisabledOutput! INFO EnabledOutput!Printingsomething...[10/15]Printingsomething...[11/15]Printingsomething...[12/15]Printingsomething...[13/15]Printingsomething...[14/15]Restartinganimation... \ No newline at end of file diff --git a/_examples/disable-output/main.go b/_examples/disable-output/main.go deleted file mode 100644 index e604abb11..000000000 --- a/_examples/disable-output/main.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - for i := 0; i < 15; i++ { - switch i { - case 5: - pterm.Info.Println("Disabled Output!") - pterm.DisableOutput() - case 10: - pterm.EnableOutput() - pterm.Info.Println("Enabled Output!") - } - - pterm.Printf("Printing something... [%d/%d]\n", i, 15) - } -} diff --git a/_examples/disable-styling/README.md b/_examples/disable-styling/README.md deleted file mode 100644 index ae4555074..000000000 --- a/_examples/disable-styling/README.md +++ /dev/null @@ -1,162 +0,0 @@ -# disable-styling - -![Animation](animation.svg) - -```go -package main - -import ( - "math/rand" - "strconv" - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Change this to time.Millisecond*200 to speed up the demo. -// Useful when debugging. -const second = time.Second - -var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - pterm.DisableStyling() - introScreen() - clear() - pseudoApplicationHeader() - time.Sleep(second) - installingPseudoList() - time.Sleep(second * 2) - pterm.DefaultSection.WithLevel(2).Println("Program Install Report") - installedProgramsSize() - time.Sleep(second * 4) - pterm.DefaultSection.Println("Tree Printer") - installedTree() - time.Sleep(second * 4) - pterm.DefaultSection.Println("TrueColor Support") - fadeText() - time.Sleep(second) - pterm.DefaultSection.Println("Bullet List Printer") - listPrinter() -} - -func installedTree() { - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Go"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - } - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s}) - } - if s == "pseudo-chrome" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"}) - } - } - - pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render() -} - -func installingPseudoList() { - pterm.DefaultSection.Println("Installing pseudo programs") - - p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start() - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Installing " + pseudoProgramList[i]) - if pseudoProgramList[i] == "pseudo-minecraft" { - pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.") - } else { - pterm.Success.Println("Installing " + pseudoProgramList[i]) - p.Increment() - } - time.Sleep(second / 2) - } - p.Stop() -} - -func listPrinter() { - pterm.NewBulletListFromString(`Good bye - Have a nice day!`, " ").Render() -} - -func fadeText() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - - str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)" - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - pterm.Info.Println(fadeInfo) -} - -func installedProgramsSize() { - d := pterm.TableData{{"Program Name", "Status", "Size"}} - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"}) - } else { - d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"}) - } - } - pterm.DefaultTable.WithHasHeader().WithData(d).Render() -} - -func pseudoApplicationHeader() *pterm.TextPrinter { - return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "Pseudo Application created with PTerm") -} - -func introScreen() { - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Render() - - pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "PTDP - PTerm Demo Program") - - pterm.Info.Println("This animation was generated with the latest version of PTerm!" + - "\nPTerm works on nearly every terminal and operating system." + - "\nIt's super easy to use!" + - "\nIf you want, you can customize everything :)" + - "\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." + - "\n" + - "\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST"))) - pterm.Println() - introSpinner, _ := pterm.DefaultSpinner.WithRemoveWhenDone(true).Start("Waiting for 15 seconds...") - time.Sleep(second) - for i := 14; i > 0; i-- { - if i > 1 { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...") - } else { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...") - } - time.Sleep(second) - } - introSpinner.Stop() -} - -func clear() { - print("\033[H\033[2J") -} - -func randomInt(min, max int) int { - rand.Seed(time.Now().UnixNano()) - return rand.Intn(max-min+1) + min -} - -``` diff --git a/_examples/disable-styling/animation.svg b/_examples/disable-styling/animation.svg deleted file mode 100644 index 78acad44c..000000000 --- a/_examples/disable-styling/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -PTermPTDP-PTermDemoProgramINFO:ThisanimationwasgeneratedwiththelatestversionofPTerm!PTermworksonnearlyeveryterminalandoperatingsystem.It'ssupereasytouse!Ifyouwant,youcancustomizeeverything:)Youcanseethecodeofthisdemointhe./_examples/demodirectory.Thisdemowasupdatedat:20Apr2022-22:19:22UTCWaitingfor15seconds...Waitingfor14seconds...Waitingfor13seconds...Waitingfor12seconds...Waitingfor11seconds...Waitingfor10seconds...Waitingfor9seconds...Waitingfor8seconds...Waitingfor7seconds...Waitingfor6seconds...Waitingfor5seconds...Waitingfor4seconds...Waitingfor3seconds...Waitingfor2seconds...Waitingfor1second...PseudoApplicationcreatedwithPTerm#InstallingpseudoprogramsInstallingstuffSUCCESS:Installingpseudo-excelSUCCESS:Installingpseudo-photoshopSUCCESS:Installingpseudo-chromeSUCCESS:Installingpseudo-outlookSUCCESS:Installingpseudo-explorerSUCCESS:Installingpseudo-dopsSUCCESS:Installingpseudo-gitSUCCESS:Installingpseudo-vscSUCCESS:Installingpseudo-intellijWARNING:Couldnotinstallpseudo-minecraftThecompanypolicyforbidsgames.SUCCESS:Installingpseudo-scoopSUCCESS:Installingpseudo-chocolatey##ProgramInstallReportProgramName|Status|Sizepseudo-excel|pass|25mbpseudo-photoshop|pass|199mbpseudo-chrome|pass|82mbpseudo-outlook|pass|32mbpseudo-explorer|pass|114mbpseudo-dops|pass|57mbpseudo-git|pass|106mbpseudo-vsc|pass|155mbpseudo-intellij|pass|80mbpseudo-minecraft|fail|0mbpseudo-scoop|pass|88mbpseudo-chocolatey|pass|105mb├──Windows└─┬Programs├──pseudo-excel├──pseudo-photoshop├─┬pseudo-chrome├──pseudo-Tabs├─┬pseudo-Extensions├──RefinedGitHub└──GitHubDarkTheme└─┬pseudo-Bookmarks└──PTerm├──pseudo-outlook├──pseudo-explorer├──pseudo-dops├──pseudo-git├──pseudo-vsc├──pseudo-intellij├──pseudo-scoop└──pseudo-chocolatey#TrueColorSupportINFO:IfyourterminalhasTrueColorsupport,youcanuseRGBcolors!Youcanevenfadethem:)#BulletListPrinterGoodbyeHaveaniceday!#TreePrinter└─┬C:├──GoRestartinganimation... \ No newline at end of file diff --git a/_examples/disable-styling/main.go b/_examples/disable-styling/main.go deleted file mode 100644 index ac30ac5b1..000000000 --- a/_examples/disable-styling/main.go +++ /dev/null @@ -1,155 +0,0 @@ -package main - -import ( - "math/rand" - "strconv" - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Change this to time.Millisecond*200 to speed up the demo. -// Useful when debugging. -const second = time.Second - -var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - pterm.DisableStyling() - introScreen() - clear() - pseudoApplicationHeader() - time.Sleep(second) - installingPseudoList() - time.Sleep(second * 2) - pterm.DefaultSection.WithLevel(2).Println("Program Install Report") - installedProgramsSize() - time.Sleep(second * 4) - pterm.DefaultSection.Println("Tree Printer") - installedTree() - time.Sleep(second * 4) - pterm.DefaultSection.Println("TrueColor Support") - fadeText() - time.Sleep(second) - pterm.DefaultSection.Println("Bullet List Printer") - listPrinter() -} - -func installedTree() { - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Go"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - } - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s}) - } - if s == "pseudo-chrome" { - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"}) - leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"}) - } - } - - pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render() -} - -func installingPseudoList() { - pterm.DefaultSection.Println("Installing pseudo programs") - - p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start() - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Installing " + pseudoProgramList[i]) - if pseudoProgramList[i] == "pseudo-minecraft" { - pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.") - } else { - pterm.Success.Println("Installing " + pseudoProgramList[i]) - p.Increment() - } - time.Sleep(second / 2) - } - p.Stop() -} - -func listPrinter() { - pterm.NewBulletListFromString(`Good bye - Have a nice day!`, " ").Render() -} - -func fadeText() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - - str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)" - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - pterm.Info.Println(fadeInfo) -} - -func installedProgramsSize() { - d := pterm.TableData{{"Program Name", "Status", "Size"}} - for _, s := range pseudoProgramList { - if s != "pseudo-minecraft" { - d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"}) - } else { - d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"}) - } - } - pterm.DefaultTable.WithHasHeader().WithData(d).Render() -} - -func pseudoApplicationHeader() *pterm.TextPrinter { - return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "Pseudo Application created with PTerm") -} - -func introScreen() { - pterm.DefaultBigText.WithLetters( - pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)), - pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))). - Render() - - pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println( - "PTDP - PTerm Demo Program") - - pterm.Info.Println("This animation was generated with the latest version of PTerm!" + - "\nPTerm works on nearly every terminal and operating system." + - "\nIt's super easy to use!" + - "\nIf you want, you can customize everything :)" + - "\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." + - "\n" + - "\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST"))) - pterm.Println() - introSpinner, _ := pterm.DefaultSpinner.WithRemoveWhenDone(true).Start("Waiting for 15 seconds...") - time.Sleep(second) - for i := 14; i > 0; i-- { - if i > 1 { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...") - } else { - introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...") - } - time.Sleep(second) - } - introSpinner.Stop() -} - -func clear() { - print("\033[H\033[2J") -} - -func randomInt(min, max int) int { - rand.Seed(time.Now().UnixNano()) - return rand.Intn(max-min+1) + min -} diff --git a/_examples/header-custom/README.md b/_examples/header-custom/README.md deleted file mode 100644 index c8d2ec956..000000000 --- a/_examples/header-custom/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# header-custom - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // All available options: https://pkg.go.dev/github.com/pterm/pterm#HeaderPrinter - - // Build on top of DefaultHeader - pterm.DefaultHeader. // Use DefaultHeader as base - WithMargin(15). - WithBackgroundStyle(pterm.NewStyle(pterm.BgCyan)). - WithTextStyle(pterm.NewStyle(pterm.FgBlack)). - Println("This is a custom header!") - // Instead of printing the header you can set it to a variable. - // You can then reuse your custom header. - - // Making a completely new HeaderPrinter - newHeader := pterm.HeaderPrinter{ - TextStyle: pterm.NewStyle(pterm.FgBlack), - BackgroundStyle: pterm.NewStyle(pterm.BgRed), - Margin: 20, - } - - // Print header. - newHeader.Println("This is a custom header!") -} - -``` diff --git a/_examples/header-custom/animation.svg b/_examples/header-custom/animation.svg deleted file mode 100644 index c7921ab66..000000000 --- a/_examples/header-custom/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - This is a custom header! This is a custom header! Restartinganimation... \ No newline at end of file diff --git a/_examples/header-custom/main.go b/_examples/header-custom/main.go deleted file mode 100644 index 3ca553b4b..000000000 --- a/_examples/header-custom/main.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // All available options: https://pkg.go.dev/github.com/pterm/pterm#HeaderPrinter - - // Build on top of DefaultHeader - pterm.DefaultHeader. // Use DefaultHeader as base - WithMargin(15). - WithBackgroundStyle(pterm.NewStyle(pterm.BgCyan)). - WithTextStyle(pterm.NewStyle(pterm.FgBlack)). - Println("This is a custom header!") - // Instead of printing the header you can set it to a variable. - // You can then reuse your custom header. - - // Making a completely new HeaderPrinter - newHeader := pterm.HeaderPrinter{ - TextStyle: pterm.NewStyle(pterm.FgBlack), - BackgroundStyle: pterm.NewStyle(pterm.BgRed), - Margin: 20, - } - - // Print header. - newHeader.Println("This is a custom header!") -} diff --git a/_examples/header/README.md b/_examples/header/README.md deleted file mode 100644 index 9ad70d682..000000000 --- a/_examples/header/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# header - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a default header. - pterm.DefaultHeader.Println("This is the default header!") - pterm.Println() // spacer - pterm.DefaultHeader.WithFullWidth().Println("This is a full-width header.") -} - -``` diff --git a/_examples/header/animation.svg b/_examples/header/animation.svg deleted file mode 100644 index 8468f55cd..000000000 --- a/_examples/header/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - This is the default header! This is a full-width header. Restartinganimation... \ No newline at end of file diff --git a/_examples/header/main.go b/_examples/header/main.go deleted file mode 100644 index a654d4d0d..000000000 --- a/_examples/header/main.go +++ /dev/null @@ -1,10 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a default header. - pterm.DefaultHeader.Println("This is the default header!") - pterm.Println() // spacer - pterm.DefaultHeader.WithFullWidth().Println("This is a full-width header.") -} diff --git a/_examples/override-default-printers/README.md b/_examples/override-default-printers/README.md deleted file mode 100644 index 567c7161f..000000000 --- a/_examples/override-default-printers/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# override-default-printers - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print default error. - pterm.Error.Println("This is the default Error") - - // Customize default error. - pterm.Error.Prefix = pterm.Prefix{ - Text: "OVERRIDE", - Style: pterm.NewStyle(pterm.BgCyan, pterm.FgRed), - } - - // Print new default error. - pterm.Error.Println("This is the default Error after the prefix was overridden") -} - -``` diff --git a/_examples/override-default-printers/animation.svg b/_examples/override-default-printers/animation.svg deleted file mode 100644 index 07ba754bf..000000000 --- a/_examples/override-default-printers/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - ERROR ThisisthedefaultError OVERRIDE ThisisthedefaultErroraftertheprefixwasoverriddenRestartinganimation... \ No newline at end of file diff --git a/_examples/override-default-printers/main.go b/_examples/override-default-printers/main.go deleted file mode 100644 index 52eb93008..000000000 --- a/_examples/override-default-printers/main.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print default error. - pterm.Error.Println("This is the default Error") - - // Customize default error. - pterm.Error.Prefix = pterm.Prefix{ - Text: "OVERRIDE", - Style: pterm.NewStyle(pterm.BgCyan, pterm.FgRed), - } - - // Print new default error. - pterm.Error.Println("This is the default Error after the prefix was overridden") -} diff --git a/_examples/panel/README.md b/_examples/panel/README.md deleted file mode 100644 index 220be07bc..000000000 --- a/_examples/panel/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# panel - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Declare panels in a two dimensional grid system. - panels := pterm.Panels{ - {{Data: "This is the first panel"}, {Data: pterm.DefaultHeader.Sprint("Hello, World!")}, {Data: "This\npanel\ncontains\nmultiple\nlines"}}, - {{Data: pterm.Red("This is another\npanel line")}, {Data: "This is the second panel\nwith a new line"}}, - } - - // Print panels. - _ = pterm.DefaultPanel.WithPanels(panels).WithPadding(5).Render() -} - -``` diff --git a/_examples/panel/animation.svg b/_examples/panel/animation.svg deleted file mode 100644 index aab802acf..000000000 --- a/_examples/panel/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Thisisthefirstpanel This Hello, World! panel containsmultiplelinesThisisanotherThisisthesecondpanelpanellinewithanewlineRestartinganimation... \ No newline at end of file diff --git a/_examples/panel/main.go b/_examples/panel/main.go deleted file mode 100644 index 8726df44a..000000000 --- a/_examples/panel/main.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Declare panels in a two dimensional grid system. - panels := pterm.Panels{ - {{Data: "This is the first panel"}, {Data: pterm.DefaultHeader.Sprint("Hello, World!")}, {Data: "This\npanel\ncontains\nmultiple\nlines"}}, - {{Data: pterm.Red("This is another\npanel line")}, {Data: "This is the second panel\nwith a new line"}}, - } - - // Print panels. - _ = pterm.DefaultPanel.WithPanels(panels).WithPadding(5).Render() -} diff --git a/_examples/paragraph-custom/README.md b/_examples/paragraph-custom/README.md deleted file mode 100644 index 3d15cd0a4..000000000 --- a/_examples/paragraph-custom/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# paragraph-custom - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a paragraph with a custom maximal width. - pterm.DefaultParagraph.WithMaxWidth(60).Println("This is a custom paragraph printer. As you can see, no words are separated, " + - "but the text is split at the spaces. This is useful for continuous text of all kinds. You can manually change the line width if you want to." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") - - // Print one line space. - pterm.Println() - - // Print text without a paragraph printer. - pterm.Println("This text is written with the default Println() function. No intelligent splitting here." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") -} - -``` diff --git a/_examples/paragraph-custom/animation.svg b/_examples/paragraph-custom/animation.svg deleted file mode 100644 index 88ea6af5b..000000000 --- a/_examples/paragraph-custom/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Thisisacustomparagraphprinter.Asyoucansee,nowordsareseparated,butthetextissplitatthespaces.Thisisusefulforcontinuoustextofallkinds.Youcanmanuallychangethelinewidthifyouwantto.Loremipsumdolorsitamet,consetetursadipscingelitr,seddiamnonumyeirmodtemporinviduntutlaboreetdoloremagnaaliquyamThistextiswrittenwiththedefaultPrintln()function.Nointelligentsplittinghere.Loremipsumdolorsitamet,consetetursadipscingelitr,seddiamnonumyeirmodtemporinviduntutlaboreetdoloremagnaaliquyamRestartinganimation... \ No newline at end of file diff --git a/_examples/paragraph-custom/main.go b/_examples/paragraph-custom/main.go deleted file mode 100644 index 39cdf8643..000000000 --- a/_examples/paragraph-custom/main.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a paragraph with a custom maximal width. - pterm.DefaultParagraph.WithMaxWidth(60).Println("This is a custom paragraph printer. As you can see, no words are separated, " + - "but the text is split at the spaces. This is useful for continuous text of all kinds. You can manually change the line width if you want to." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") - - // Print one line space. - pterm.Println() - - // Print text without a paragraph printer. - pterm.Println("This text is written with the default Println() function. No intelligent splitting here." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") -} diff --git a/_examples/paragraph/README.md b/_examples/paragraph/README.md deleted file mode 100644 index 07ad0d57c..000000000 --- a/_examples/paragraph/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# paragraph - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print long text with default paragraph printer. - pterm.DefaultParagraph.Println("This is the default paragraph printer. As you can see, no words are separated, " + - "but the text is split at the spaces. This is useful for continuous text of all kinds. You can manually change the line width if you want to." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") - - // Print one line space. - pterm.Println() - - // Print long text without paragraph printer. - pterm.Println("This text is written with the default Println() function. No intelligent splitting here." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") -} - -``` diff --git a/_examples/paragraph/animation.svg b/_examples/paragraph/animation.svg deleted file mode 100644 index 85fe6c920..000000000 --- a/_examples/paragraph/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Thisisthedefaultparagraphprinter.Asyoucansee,nowordsareseparated,butthetextissplitatthespaces.Thisisusefulforcontinuoustextofallkinds.Youcanmanuallychangethelinewidthifyouwantto.Loremipsumdolorsitamet,consetetursadipscingelitr,seddiamnonumyeirmodtemporinviduntutlaboreetdoloremagnaaliquyamThistextiswrittenwiththedefaultPrintln()function.Nointelligentsplittinghere.Loremipsumdolorsitamet,consetetursadipscingelitr,seddiamnonumyeirmodtemporinviduntutlaboreetdoloremagnaaliquyamRestartinganimation... \ No newline at end of file diff --git a/_examples/paragraph/main.go b/_examples/paragraph/main.go deleted file mode 100644 index 4558ea73c..000000000 --- a/_examples/paragraph/main.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print long text with default paragraph printer. - pterm.DefaultParagraph.Println("This is the default paragraph printer. As you can see, no words are separated, " + - "but the text is split at the spaces. This is useful for continuous text of all kinds. You can manually change the line width if you want to." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") - - // Print one line space. - pterm.Println() - - // Print long text without paragraph printer. - pterm.Println("This text is written with the default Println() function. No intelligent splitting here." + - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam") -} diff --git a/_examples/prefix/README.md b/_examples/prefix/README.md deleted file mode 100644 index 3d23fe3ec..000000000 --- a/_examples/prefix/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# prefix - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Enable debug messages. - pterm.EnableDebugMessages() - - pterm.Debug.Println("Hello, World!") // Print Debug. - pterm.Info.Println("Hello, World!") // Print Info. - pterm.Success.Println("Hello, World!") // Print Success. - pterm.Warning.Println("Hello, World!") // Print Warning. - pterm.Error.Println("Errors show the filename and linenumber inside the terminal!") // Print Error. - pterm.Info.WithShowLineNumber().Println("Other PrefixPrinters can do that too!") // Print Error. - // Temporarily set Fatal to false, so that the CI won't crash. - pterm.Fatal.WithFatal(false).Println("Hello, World!") // Print Fatal. -} - -``` diff --git a/_examples/prefix/animation.svg b/_examples/prefix/animation.svg deleted file mode 100644 index 3a9282ead..000000000 --- a/_examples/prefix/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - DEBUG Hello,World! INFO Hello,World! SUCCESS Hello,World! WARNING Hello,World! ERROR Errorsshowthefilenameandlinenumberinsidetheterminal! INFO OtherPrefixPrinterscandothattoo!(/github/workspace/_examples/prefix/main.go:14) FATAL Hello,World!Restartinganimation... \ No newline at end of file diff --git a/_examples/prefix/main.go b/_examples/prefix/main.go deleted file mode 100644 index b032b4503..000000000 --- a/_examples/prefix/main.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Enable debug messages. - pterm.EnableDebugMessages() - - pterm.Debug.Println("Hello, World!") // Print Debug. - pterm.Info.Println("Hello, World!") // Print Info. - pterm.Success.Println("Hello, World!") // Print Success. - pterm.Warning.Println("Hello, World!") // Print Warning. - pterm.Error.Println("Errors show the filename and linenumber inside the terminal!") // Print Error. - pterm.Info.WithShowLineNumber().Println("Other PrefixPrinters can do that too!") // Print Error. - // Temporarily set Fatal to false, so that the CI won't crash. - pterm.Fatal.WithFatal(false).Println("Hello, World!") // Print Fatal. -} diff --git a/_examples/print-basic-text/README.md b/_examples/print-basic-text/README.md deleted file mode 100644 index ce498440a..000000000 --- a/_examples/print-basic-text/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# print-basic-text - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // A BasicText printer is used to print text, without special formatting. - // As it implements the TextPrinter interface, you can use it in combination with other printers. - pterm.DefaultBasicText.Println("Default basic text printer.") - pterm.DefaultBasicText.Println("Can be used in any" + pterm.LightMagenta(" TextPrinter ") + "context.") - pterm.DefaultBasicText.Println("For example to resolve progressbars and spinners.") - // If you just want to print text, you should use this instead: - // pterm.Println("Hello, World!") -} - -``` diff --git a/_examples/print-basic-text/animation.svg b/_examples/print-basic-text/animation.svg deleted file mode 100644 index f8e0480f3..000000000 --- a/_examples/print-basic-text/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Defaultbasictextprinter.CanbeusedinanyTextPrintercontext.Forexampletoresolveprogressbarsandspinners.Restartinganimation... \ No newline at end of file diff --git a/_examples/print-basic-text/main.go b/_examples/print-basic-text/main.go deleted file mode 100644 index 249e53e04..000000000 --- a/_examples/print-basic-text/main.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // A BasicText printer is used to print text, without special formatting. - // As it implements the TextPrinter interface, you can use it in combination with other printers. - pterm.DefaultBasicText.Println("Default basic text printer.") - pterm.DefaultBasicText.Println("Can be used in any" + pterm.LightMagenta(" TextPrinter ") + "context.") - pterm.DefaultBasicText.Println("For example to resolve progressbars and spinners.") - // If you just want to print text, you should use this instead: - // pterm.Println("Hello, World!") -} diff --git a/_examples/print-color-fade-multiple/README.md b/_examples/print-color-fade-multiple/README.md deleted file mode 100644 index 85b091cee..000000000 --- a/_examples/print-color-fade-multiple/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# print-color-fade-multiple - -![Animation](animation.svg) - -```go -package main - -import ( - "strings" - - "github.com/pterm/pterm" -) - -func main() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - to2 := pterm.NewRGB(255, 0, 0) // This RGB value is used as the gradients second point. - to3 := pterm.NewRGB(0, 255, 0) // This RGB value is used as the gradients third point. - to4 := pterm.NewRGB(255, 255, 255) // This RGB value is used as the gradients end point. - - str := "RGB colors only work in Terminals which support TrueColor." - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - - // Print info. - pterm.Info.Println(fadeInfo) - - // For loop over the range of the terminal height. - for i := 0; i < pterm.GetTerminalHeight()-2; i++ { - // Print string which is colored with the faded RGB value. - from.Fade(0, float32(pterm.GetTerminalHeight()-2), float32(i), to, to2, to3, to4).Println("Hello, World!") - } -} - -``` diff --git a/_examples/print-color-fade-multiple/animation.svg b/_examples/print-color-fade-multiple/animation.svg deleted file mode 100644 index ee0589893..000000000 --- a/_examples/print-color-fade-multiple/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - INFO RGBcolorsonlyworkinTerminalswhichsupportTrueColor.Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World! INFO RGBcolorsonlyworkinTerminalswRestartinganimation... \ No newline at end of file diff --git a/_examples/print-color-fade-multiple/main.go b/_examples/print-color-fade-multiple/main.go deleted file mode 100644 index c81700f0e..000000000 --- a/_examples/print-color-fade-multiple/main.go +++ /dev/null @@ -1,33 +0,0 @@ -package main - -import ( - "strings" - - "github.com/pterm/pterm" -) - -func main() { - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients first point. - to2 := pterm.NewRGB(255, 0, 0) // This RGB value is used as the gradients second point. - to3 := pterm.NewRGB(0, 255, 0) // This RGB value is used as the gradients third point. - to4 := pterm.NewRGB(255, 255, 255) // This RGB value is used as the gradients end point. - - str := "RGB colors only work in Terminals which support TrueColor." - strs := strings.Split(str, "") - var fadeInfo string // String which will be used to print info. - // For loop over the range of the string length. - for i := 0; i < len(str); i++ { - // Append faded letter to info string. - fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i]) - } - - // Print info. - pterm.Info.Println(fadeInfo) - - // For loop over the range of the terminal height. - for i := 0; i < pterm.GetTerminalHeight()-2; i++ { - // Print string which is colored with the faded RGB value. - from.Fade(0, float32(pterm.GetTerminalHeight()-2), float32(i), to, to2, to3, to4).Println("Hello, World!") - } -} diff --git a/_examples/print-color-fade/README.md b/_examples/print-color-fade/README.md deleted file mode 100644 index 35c1dbd01..000000000 --- a/_examples/print-color-fade/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# print-color-fade - -![Animation](animation.svg) - -```go -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - // Print info. - pterm.Info.Println("RGB colors only work in Terminals which support TrueColor.") - - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients end point. - - // For loop over the range of the terminal height. - for i := 0; i < pterm.GetTerminalHeight()-2; i++ { - // Print string which is colored with the faded RGB value. - from.Fade(0, float32(pterm.GetTerminalHeight()-2), float32(i), to).Println("Hello, World!") - } -} - -``` diff --git a/_examples/print-color-fade/animation.svg b/_examples/print-color-fade/animation.svg deleted file mode 100644 index 64f1bd2a7..000000000 --- a/_examples/print-color-fade/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - INFO RGBcolorsonlyworkinTerminalswhichsupportTrueColor.Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Hello,World!Restartinganimation... \ No newline at end of file diff --git a/_examples/print-color-fade/main.go b/_examples/print-color-fade/main.go deleted file mode 100644 index 23473fcc6..000000000 --- a/_examples/print-color-fade/main.go +++ /dev/null @@ -1,19 +0,0 @@ -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - // Print info. - pterm.Info.Println("RGB colors only work in Terminals which support TrueColor.") - - from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point. - to := pterm.NewRGB(255, 0, 255) // This RGB value is used as the gradients end point. - - // For loop over the range of the terminal height. - for i := 0; i < pterm.GetTerminalHeight()-2; i++ { - // Print string which is colored with the faded RGB value. - from.Fade(0, float32(pterm.GetTerminalHeight()-2), float32(i), to).Println("Hello, World!") - } -} diff --git a/_examples/print-color-rgb/README.md b/_examples/print-color-rgb/README.md deleted file mode 100644 index e96e5084b..000000000 --- a/_examples/print-color-rgb/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# print-color-rgb - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print strings with a custom RGB color. - // NOTICE: This only works with terminals which support TrueColor. - pterm.NewRGB(178, 44, 199).Println("This text is printed with a custom RGB!") - pterm.NewRGB(15, 199, 209).Println("This text is printed with a custom RGB!") - pterm.NewRGB(201, 144, 30).Println("This text is printed with a custom RGB!") -} - -``` diff --git a/_examples/print-color-rgb/animation.svg b/_examples/print-color-rgb/animation.svg deleted file mode 100644 index f7ff6765e..000000000 --- a/_examples/print-color-rgb/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -ThistextisprintedwithacustomRGB!ThistextisprintedwithacustomRGB!ThistextisprintedwithacustomRGB!Restartinganimation... \ No newline at end of file diff --git a/_examples/print-color-rgb/main.go b/_examples/print-color-rgb/main.go deleted file mode 100644 index c849785d1..000000000 --- a/_examples/print-color-rgb/main.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print strings with a custom RGB color. - // NOTICE: This only works with terminals which support TrueColor. - pterm.NewRGB(178, 44, 199).Println("This text is printed with a custom RGB!") - pterm.NewRGB(15, 199, 209).Println("This text is printed with a custom RGB!") - pterm.NewRGB(201, 144, 30).Println("This text is printed with a custom RGB!") -} diff --git a/_examples/print-with-color/README.md b/_examples/print-with-color/README.md deleted file mode 100644 index fb5e134e8..000000000 --- a/_examples/print-with-color/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# print-with-color - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print different colored words. - pterm.Println(pterm.Red("Hello, ") + pterm.Green("World") + pterm.Cyan("!")) - pterm.Println(pterm.Red("Even " + pterm.Cyan("nested ") + pterm.Green("colors ") + "are supported!")) - - // Print strings with set color. - pterm.FgBlack.Println("FgBlack") - pterm.FgRed.Println("FgRed") - pterm.FgGreen.Println("FgGreen") - pterm.FgYellow.Println("FgYellow") - pterm.FgBlue.Println("FgBlue") - pterm.FgMagenta.Println("FgMagenta") - pterm.FgCyan.Println("FgCyan") - pterm.FgWhite.Println("FgWhite") - pterm.Println() // Print one line space. - pterm.FgLightRed.Println("FgLightRed") - pterm.FgLightGreen.Println("FgLightGreen") - pterm.FgLightYellow.Println("FgLightYellow") - pterm.FgLightBlue.Println("FgLightBlue") - pterm.FgLightMagenta.Println("FgLightMagenta") - pterm.FgLightCyan.Println("FgLightCyan") - pterm.FgLightWhite.Println("FgLightWhite") -} - -``` diff --git a/_examples/print-with-color/animation.svg b/_examples/print-with-color/animation.svg deleted file mode 100644 index 812846748..000000000 --- a/_examples/print-with-color/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Hello,World!Evennestedcolorsaresupported!FgBlackFgRedFgGreenFgYellowFgBlueFgMagentaFgCyanFgWhiteFgLightRedFgLightGreenFgLightYellowFgLightBlueFgLightMagentaFgLightCyanFgLightWhiteRestartinganimation... \ No newline at end of file diff --git a/_examples/print-with-color/main.go b/_examples/print-with-color/main.go deleted file mode 100644 index bc2123645..000000000 --- a/_examples/print-with-color/main.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print different colored words. - pterm.Println(pterm.Red("Hello, ") + pterm.Green("World") + pterm.Cyan("!")) - pterm.Println(pterm.Red("Even " + pterm.Cyan("nested ") + pterm.Green("colors ") + "are supported!")) - - // Print strings with set color. - pterm.FgBlack.Println("FgBlack") - pterm.FgRed.Println("FgRed") - pterm.FgGreen.Println("FgGreen") - pterm.FgYellow.Println("FgYellow") - pterm.FgBlue.Println("FgBlue") - pterm.FgMagenta.Println("FgMagenta") - pterm.FgCyan.Println("FgCyan") - pterm.FgWhite.Println("FgWhite") - pterm.Println() // Print one line space. - pterm.FgLightRed.Println("FgLightRed") - pterm.FgLightGreen.Println("FgLightGreen") - pterm.FgLightYellow.Println("FgLightYellow") - pterm.FgLightBlue.Println("FgLightBlue") - pterm.FgLightMagenta.Println("FgLightMagenta") - pterm.FgLightCyan.Println("FgLightCyan") - pterm.FgLightWhite.Println("FgLightWhite") -} diff --git a/_examples/progressbar/README.md b/_examples/progressbar/README.md deleted file mode 100644 index 250d14098..000000000 --- a/_examples/progressbar/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# progressbar - -![Animation](animation.svg) - -```go -package main - -import ( - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Slice of strings with placeholder text. -var fakeInstallList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - // Create progressbar as fork from the default progressbar. - p, _ := pterm.DefaultProgressbar.WithTotal(len(fakeInstallList)).WithTitle("Downloading stuff").Start() - - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Downloading " + fakeInstallList[i]) // Update the title of the progressbar. - pterm.Success.Println("Downloading " + fakeInstallList[i]) // If a progressbar is running, each print will be printed above the progressbar. - p.Increment() // Increment the progressbar by one. Use Add(x int) to increment by a custom amount. - time.Sleep(time.Millisecond * 350) // Sleep 350 milliseconds. - } -} - -``` diff --git a/_examples/progressbar/animation.svg b/_examples/progressbar/animation.svg deleted file mode 100644 index cb00e35b8..000000000 --- a/_examples/progressbar/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - SUCCESS Downloadingpseudo-excel SUCCESS Downloadingpseudo-photoshop SUCCESS Downloadingpseudo-chrome SUCCESS Downloadingpseudo-outlook SUCCESS Downloadingpseudo-explorer SUCCESS Downloadingpseudo-dops SUCCESS Downloadingpseudo-git SUCCESS Downloadingpseudo-vsc SUCCESS Downloadingpseudo-intellij SUCCESS Downloadingpseudo-minecraft SUCCESS Downloadingpseudo-scoop SUCCESS Downloadingpseudo-chocolateyDownloadingpseudo-chocolatey[12/12]████████████████████████████████100%|4sDownloadingpseudo-excel[1/12]████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░8%|0sDownloadingpseudo-photoshop[1/12]███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░8%|0sDownloadingpseudo-photoshop[2/12]██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░17%|0sDownloadingpseudo-chrome[2/12]███████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░17%|1sDownloadingpseudo-chrome[3/12]██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░25%|1sDownloadingpseudo-outlook[4/12]█████████████░░░░░░░░░░░░░░░░░░░░░░░░33%|1sDownloadingpseudo-explorer[4/12]████████████░░░░░░░░░░░░░░░░░░░░░░░░33%|1sDownloadingpseudo-explorer[5/12]███████████████░░░░░░░░░░░░░░░░░░░░░42%|1sDownloadingpseudo-dops[6/12]████████████████████░░░░░░░░░░░░░░░░░░░░50%|2sDownloadingpseudo-git[7/12]████████████████████████░░░░░░░░░░░░░░░░░58%|2sDownloadingpseudo-vsc[8/12]███████████████████████████░░░░░░░░░░░░░░67%|2sDownloadingpseudo-intellij[9/12]███████████████████████████░░░░░░░░░75%|3sDownloadingpseudo-minecraft[9/12]██████████████████████████░░░░░░░░░75%|3sDownloadingpseudo-minecraft[10/12]████████████████████████████░░░░░░83%|3sDownloadingpseudo-scoop[10/12]███████████████████████████████░░░░░░░83%|4sDownloadingpseudo-scoop[11/12]██████████████████████████████████░░░░92%|4sRestartinganimation... \ No newline at end of file diff --git a/_examples/progressbar/main.go b/_examples/progressbar/main.go deleted file mode 100644 index 68819b458..000000000 --- a/_examples/progressbar/main.go +++ /dev/null @@ -1,24 +0,0 @@ -package main - -import ( - "strings" - "time" - - "github.com/pterm/pterm" -) - -// Slice of strings with placeholder text. -var fakeInstallList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+ - "pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ") - -func main() { - // Create progressbar as fork from the default progressbar. - p, _ := pterm.DefaultProgressbar.WithTotal(len(fakeInstallList)).WithTitle("Downloading stuff").Start() - - for i := 0; i < p.Total; i++ { - p.UpdateTitle("Downloading " + fakeInstallList[i]) // Update the title of the progressbar. - pterm.Success.Println("Downloading " + fakeInstallList[i]) // If a progressbar is running, each print will be printed above the progressbar. - p.Increment() // Increment the progressbar by one. Use Add(x int) to increment by a custom amount. - time.Sleep(time.Millisecond * 350) // Sleep 350 milliseconds. - } -} diff --git a/_examples/section/README.md b/_examples/section/README.md deleted file mode 100644 index dd04dbf02..000000000 --- a/_examples/section/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# section - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a section with level one. - pterm.DefaultSection.Println("This is a section!") - // Print placeholder. - pterm.Info.Println("And here is some text.\nThis text could be anything.\nBasically it's just a placeholder") - - // Print a section with level two. - pterm.DefaultSection.WithLevel(2).Println("This is another section!") - // Print placeholder. - pterm.Info.Println("And this is\nmore placeholder text") -} - -``` diff --git a/_examples/section/animation.svg b/_examples/section/animation.svg deleted file mode 100644 index cbc9e3a7f..000000000 --- a/_examples/section/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -#Thisisasection! INFO Andhereissometext. Thistextcouldbeanything. Basicallyit'sjustaplaceholder##Thisisanothersection! INFO Andthisis moreplaceholdertextRestartinganimation... \ No newline at end of file diff --git a/_examples/section/main.go b/_examples/section/main.go deleted file mode 100644 index 80933f69d..000000000 --- a/_examples/section/main.go +++ /dev/null @@ -1,15 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Print a section with level one. - pterm.DefaultSection.Println("This is a section!") - // Print placeholder. - pterm.Info.Println("And here is some text.\nThis text could be anything.\nBasically it's just a placeholder") - - // Print a section with level two. - pterm.DefaultSection.WithLevel(2).Println("This is another section!") - // Print placeholder. - pterm.Info.Println("And this is\nmore placeholder text") -} diff --git a/_examples/spinner/README.md b/_examples/spinner/README.md deleted file mode 100644 index 95583c282..000000000 --- a/_examples/spinner/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# spinner - -![Animation](animation.svg) - -```go -package main - -import ( - "time" - - "github.com/pterm/pterm" -) - -func main() { - // Create and start a fork of the default spinner. - spinnerSuccess, _ := pterm.DefaultSpinner.Start("Doing something important... (will succeed)") - time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something. - spinnerSuccess.Success() // Resolve spinner with success message. - - // Create and start a fork of the default spinner. - spinnerWarning, _ := pterm.DefaultSpinner.Start("Doing something important... (will warn)") - time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something. - spinnerWarning.Warning() // Resolve spinner with warning message. - - // Create and start a fork of the default spinner. - spinnerFail, _ := pterm.DefaultSpinner.Start("Doing something important... (will fail)") - time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something. - spinnerFail.Fail() // Resolve spinner with error message. - - // Create and start a fork of the default spinner. - spinnerLiveText, _ := pterm.DefaultSpinner.Start("Doing a lot of stuff...") - time.Sleep(time.Second) // Simulate 2 seconds of processing something. - spinnerLiveText.UpdateText("It's really much") // Update spinner text. - time.Sleep(time.Second) // Simulate 2 seconds of processing something. - spinnerLiveText.UpdateText("We're nearly done!") // Update spinner text. - time.Sleep(time.Second) // Simulate 2 seconds of processing something. - spinnerLiveText.Success("Finally!") // Resolve spinner with success message. -} - -``` diff --git a/_examples/spinner/animation.svg b/_examples/spinner/animation.svg deleted file mode 100644 index 4403516f5..000000000 --- a/_examples/spinner/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Doingsomethingimportant...(willsucceed)(1s) SUCCESS Doingsomethingimportant...(willsucceed)Doingsomethingimportant...(willwarn)(1s) WARNING Doingsomethingimportant...(willwarn)Doingsomethingimportant...(willfail)(1s) ERROR Doingsomethingimportant...(willfail) SUCCESS Finally!Doingsomethingimportant...(willsucceed)(0s)Doingsomethingimportant...(willsucceed)(0s)Doingsomethingimportant...(willsucceed)(0s)Doingsomethingimportant...(willsucceed)(1s)Doingsomethingimportant...(willsucceed)(1s)Doingsomethingimportant...(willsucceed)(1s)Doingsomethingimportant...(willsucceed)(2s)Doingsomethingimportant...(willsucceed)(2s)Doingsomethingimportant...(willwarn)(0s)Doingsomethingimportant...(willwarn)(0s)Doingsomethingimportant...(willwarn)(0s)Doingsomethingimportant...(willwarn)(1s)Doingsomethingimportant...(willwarn)(1s)Doingsomethingimportant...(willwarn)(1s)Doingsomethingimportant...(willwarn)(2s)Doingsomethingimportant...(willwarn)(2s)Doingsomethingimportant...(willfail)(0s)Doingsomethingimportant...(willfail)(0s)Doingsomethingimportant...(willfail)(0s)Doingsomethingimportant...(willfail)(1s)Doingsomethingimportant...(willfail)(1s)Doingsomethingimportant...(willfail)(1s)Doingsomethingimportant...(willfail)(2s)Doingsomethingimportant...(willfail)(2s)Doingalotofstuff...(0s)Doingalotofstuff...(0s)Doingalotofstuff...(0s)Doingalotofstuff...(1s)Doingalotofstuff...(1s)It'sreallymuchIt'sreallymuch(1s)It'sreallymuch(1s)It'sreallymuch(1s)It'sreallymuch(2s)It'sreallymuch(2s)We'renearlydone!We'renearlydone!(2s)We'renearlydone!(2s)We'renearlydone!(2s)We'renearlydone!(3s)We'renearlydone!(3s)Restartinganimation... \ No newline at end of file diff --git a/_examples/spinner/main.go b/_examples/spinner/main.go deleted file mode 100644 index cacd45f56..000000000 --- a/_examples/spinner/main.go +++ /dev/null @@ -1,33 +0,0 @@ -package main - -import ( - "time" - - "github.com/pterm/pterm" -) - -func main() { - // Create and start a fork of the default spinner. - spinnerSuccess, _ := pterm.DefaultSpinner.Start("Doing something important... (will succeed)") - time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something. - spinnerSuccess.Success() // Resolve spinner with success message. - - // Create and start a fork of the default spinner. - spinnerWarning, _ := pterm.DefaultSpinner.Start("Doing something important... (will warn)") - time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something. - spinnerWarning.Warning() // Resolve spinner with warning message. - - // Create and start a fork of the default spinner. - spinnerFail, _ := pterm.DefaultSpinner.Start("Doing something important... (will fail)") - time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something. - spinnerFail.Fail() // Resolve spinner with error message. - - // Create and start a fork of the default spinner. - spinnerLiveText, _ := pterm.DefaultSpinner.Start("Doing a lot of stuff...") - time.Sleep(time.Second) // Simulate 2 seconds of processing something. - spinnerLiveText.UpdateText("It's really much") // Update spinner text. - time.Sleep(time.Second) // Simulate 2 seconds of processing something. - spinnerLiveText.UpdateText("We're nearly done!") // Update spinner text. - time.Sleep(time.Second) // Simulate 2 seconds of processing something. - spinnerLiveText.Success("Finally!") // Resolve spinner with success message. -} diff --git a/_examples/style/README.md b/_examples/style/README.md deleted file mode 100644 index 1b11de92e..000000000 --- a/_examples/style/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# style - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Create styles as new variables - primary := pterm.NewStyle(pterm.FgLightCyan, pterm.BgGray, pterm.Bold) - secondary := pterm.NewStyle(pterm.FgLightGreen, pterm.BgWhite, pterm.Italic) - - // Use created styles - primary.Println("Hello, World!") - secondary.Println("Hello, World!") -} - -``` diff --git a/_examples/style/animation.svg b/_examples/style/animation.svg deleted file mode 100644 index 6db76bdd8..000000000 --- a/_examples/style/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Hello, World!Hello, World!Restartinganimation... \ No newline at end of file diff --git a/_examples/style/main.go b/_examples/style/main.go deleted file mode 100644 index 74ff150dc..000000000 --- a/_examples/style/main.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Create styles as new variables - primary := pterm.NewStyle(pterm.FgLightCyan, pterm.BgGray, pterm.Bold) - secondary := pterm.NewStyle(pterm.FgLightGreen, pterm.BgWhite, pterm.Italic) - - // Use created styles - primary.Println("Hello, World!") - secondary.Println("Hello, World!") -} diff --git a/_examples/table/README.md b/_examples/table/README.md deleted file mode 100644 index 23ed3fba8..000000000 --- a/_examples/table/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# table - -![Animation](animation.svg) - -```go -package main - -import "github.com/pterm/pterm" - -func main() { - // Create a fork of the default table, fill it with data and print it. - // Data can also be generated and inserted later. - pterm.DefaultTable.WithHasHeader().WithData(pterm.TableData{ - {"Firstname", "Lastname", "Email"}, - {"Paul", "Dean", "nisi.dictum.augue@velitAliquam.co.uk"}, - {"Callie", "Mckay", "egestas.nunc.sed@est.com"}, - {"Libby", "Camacho", "aliquet.lobortis@semper.com"}, - }).Render() - - pterm.Println() // Blank line - - // Create a table with right alignment. - pterm.DefaultTable.WithHasHeader().WithData(pterm.TableData{ - {"Firstname", "Lastname", "Email"}, - {"Paul", "Dean", "nisi.dictum.augue@velitAliquam.co.uk"}, - {"Callie", "Mckay", "egestas.nunc.sed@est.com"}, - {"Libby", "Camacho", "aliquet.lobortis@semper.com"}, - }).WithRightAlignment().Render() -} - -``` diff --git a/_examples/table/animation.svg b/_examples/table/animation.svg deleted file mode 100644 index 6754d9665..000000000 --- a/_examples/table/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -Firstname|Lastname|EmailPaul|Dean|nisi.dictum.augue@velitAliquam.co.ukCallie|Mckay|egestas.nunc.sed@est.comLibby|Camacho|aliquet.lobortis@semper.comFirstname|Lastname|EmailPaul|Dean|nisi.dictum.augue@velitAliquam.co.ukCallie|Mckay|egestas.nunc.sed@est.comLibby|Camacho|aliquet.lobortis@semper.comRestartinganimation... \ No newline at end of file diff --git a/_examples/table/main.go b/_examples/table/main.go deleted file mode 100644 index 94f41c624..000000000 --- a/_examples/table/main.go +++ /dev/null @@ -1,24 +0,0 @@ -package main - -import "github.com/pterm/pterm" - -func main() { - // Create a fork of the default table, fill it with data and print it. - // Data can also be generated and inserted later. - pterm.DefaultTable.WithHasHeader().WithData(pterm.TableData{ - {"Firstname", "Lastname", "Email"}, - {"Paul", "Dean", "nisi.dictum.augue@velitAliquam.co.uk"}, - {"Callie", "Mckay", "egestas.nunc.sed@est.com"}, - {"Libby", "Camacho", "aliquet.lobortis@semper.com"}, - }).Render() - - pterm.Println() // Blank line - - // Create a table with right alignment. - pterm.DefaultTable.WithHasHeader().WithData(pterm.TableData{ - {"Firstname", "Lastname", "Email"}, - {"Paul", "Dean", "nisi.dictum.augue@velitAliquam.co.uk"}, - {"Callie", "Mckay", "egestas.nunc.sed@est.com"}, - {"Libby", "Camacho", "aliquet.lobortis@semper.com"}, - }).WithRightAlignment().Render() -} diff --git a/_examples/theme/README.md b/_examples/theme/README.md deleted file mode 100644 index 2d4de7678..000000000 --- a/_examples/theme/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# theme - -![Animation](animation.svg) - -```go -package main - -import ( - "github.com/pterm/pterm" - "reflect" - "time" -) - -func main() { - // Print info. - pterm.Info.Println("These are the default theme styles.\n" + - "You can modify them easily to your personal preference,\n" + - "or create new themes from scratch :)") - - pterm.Println() // Print one line space. - - // Print every value of the default theme with its own style. - v := reflect.ValueOf(pterm.ThemeDefault) - typeOfS := v.Type() - - if typeOfS == reflect.TypeOf(pterm.Theme{}) { - for i := 0; i < v.NumField(); i++ { - field, ok := v.Field(i).Interface().(pterm.Style) - if ok { - field.Println(typeOfS.Field(i).Name) - } - time.Sleep(time.Millisecond * 250) - } - } -} - -``` diff --git a/_examples/theme/animation.svg b/_examples/theme/animation.svg deleted file mode 100644 index 993d43409..000000000 --- a/_examples/theme/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ - INFO Thesearethedefaultthemestyles. Youcanmodifythemeasilytoyourpersonalpreference, orcreatenewthemesfromscratch:)PrimaryStyleSecondaryStyleHighlightStyleInfoMessageStyleInfoPrefixStyleSuccessMessageStyleSuccessPrefixStyleWarningMessageStyleWarningPrefixStyleErrorMessageStyleErrorPrefixStyleFatalMessageStyleFatalPrefixStyleDescriptionMessageStyleDescriptionPrefixStyleScopeStyleProgressbarBarStyleProgressbarTitleStyleHeaderTextStyleHeaderBackgroundStyleSpinnerStyleSpinnerTextStyleTimerStyleTableStyleTableHeaderStyleTableSeparatorStyleSectionStyleBulletListTextStyleBulletListBulletStyleTreeStyleTreeTextStyleLetterStyleDebugMessageStyleDebugPrefixStyleBoxStyleBoxTextStyleBarLabelStyleBarStyleRestartinganimation... \ No newline at end of file diff --git a/_examples/theme/main.go b/_examples/theme/main.go deleted file mode 100644 index 6813d3f41..000000000 --- a/_examples/theme/main.go +++ /dev/null @@ -1,30 +0,0 @@ -package main - -import ( - "github.com/pterm/pterm" - "reflect" - "time" -) - -func main() { - // Print info. - pterm.Info.Println("These are the default theme styles.\n" + - "You can modify them easily to your personal preference,\n" + - "or create new themes from scratch :)") - - pterm.Println() // Print one line space. - - // Print every value of the default theme with its own style. - v := reflect.ValueOf(pterm.ThemeDefault) - typeOfS := v.Type() - - if typeOfS == reflect.TypeOf(pterm.Theme{}) { - for i := 0; i < v.NumField(); i++ { - field, ok := v.Field(i).Interface().(pterm.Style) - if ok { - field.Println(typeOfS.Field(i).Name) - } - time.Sleep(time.Millisecond * 250) - } - } -} diff --git a/_examples/tree/README.md b/_examples/tree/README.md deleted file mode 100644 index 7a9eab639..000000000 --- a/_examples/tree/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# tree - -![Animation](animation.svg) - -```go -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - // You can use a LeveledList here, for easy generation. - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Users"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - pterm.LeveledListItem{Level: 1, Text: "Programs(x86)"}, - pterm.LeveledListItem{Level: 1, Text: "dev"}, - pterm.LeveledListItem{Level: 0, Text: "D:"}, - pterm.LeveledListItem{Level: 0, Text: "E:"}, - pterm.LeveledListItem{Level: 1, Text: "Movies"}, - pterm.LeveledListItem{Level: 1, Text: "Music"}, - pterm.LeveledListItem{Level: 2, Text: "LinkinPark"}, - pterm.LeveledListItem{Level: 1, Text: "Games"}, - pterm.LeveledListItem{Level: 2, Text: "Shooter"}, - pterm.LeveledListItem{Level: 3, Text: "CallOfDuty"}, - pterm.LeveledListItem{Level: 3, Text: "CS:GO"}, - pterm.LeveledListItem{Level: 3, Text: "Battlefield"}, - pterm.LeveledListItem{Level: 4, Text: "Battlefield 1"}, - pterm.LeveledListItem{Level: 4, Text: "Battlefield 2"}, - pterm.LeveledListItem{Level: 0, Text: "F:"}, - pterm.LeveledListItem{Level: 1, Text: "dev"}, - pterm.LeveledListItem{Level: 2, Text: "dops"}, - pterm.LeveledListItem{Level: 2, Text: "PTerm"}, - } - - // Generate tree from LeveledList. - root := pterm.NewTreeFromLeveledList(leveledList) - - // Render TreePrinter - pterm.DefaultTree.WithRoot(root).Render() -} - -``` diff --git a/_examples/tree/animation.svg b/_examples/tree/animation.svg deleted file mode 100644 index b2bb8015c..000000000 --- a/_examples/tree/animation.svg +++ /dev/null @@ -1,10 +0,0 @@ -├─┬C:├──Users├──Windows├──Programs├──Programs(x86)└──dev├──D:├─┬E:├──Movies├─┬Music└──LinkinPark└─┬Games└─┬Shooter├──CallOfDuty├──CS:GO└─┬Battlefield├──Battlefield1└──Battlefield2└─├─┬Muestartinganimation... \ No newline at end of file diff --git a/_examples/tree/main.go b/_examples/tree/main.go deleted file mode 100644 index b6dbf894c..000000000 --- a/_examples/tree/main.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "github.com/pterm/pterm" -) - -func main() { - // You can use a LeveledList here, for easy generation. - leveledList := pterm.LeveledList{ - pterm.LeveledListItem{Level: 0, Text: "C:"}, - pterm.LeveledListItem{Level: 1, Text: "Users"}, - pterm.LeveledListItem{Level: 1, Text: "Windows"}, - pterm.LeveledListItem{Level: 1, Text: "Programs"}, - pterm.LeveledListItem{Level: 1, Text: "Programs(x86)"}, - pterm.LeveledListItem{Level: 1, Text: "dev"}, - pterm.LeveledListItem{Level: 0, Text: "D:"}, - pterm.LeveledListItem{Level: 0, Text: "E:"}, - pterm.LeveledListItem{Level: 1, Text: "Movies"}, - pterm.LeveledListItem{Level: 1, Text: "Music"}, - pterm.LeveledListItem{Level: 2, Text: "LinkinPark"}, - pterm.LeveledListItem{Level: 1, Text: "Games"}, - pterm.LeveledListItem{Level: 2, Text: "Shooter"}, - pterm.LeveledListItem{Level: 3, Text: "CallOfDuty"}, - pterm.LeveledListItem{Level: 3, Text: "CS:GO"}, - pterm.LeveledListItem{Level: 3, Text: "Battlefield"}, - pterm.LeveledListItem{Level: 4, Text: "Battlefield 1"}, - pterm.LeveledListItem{Level: 4, Text: "Battlefield 2"}, - pterm.LeveledListItem{Level: 0, Text: "F:"}, - pterm.LeveledListItem{Level: 1, Text: "dev"}, - pterm.LeveledListItem{Level: 2, Text: "dops"}, - pterm.LeveledListItem{Level: 2, Text: "PTerm"}, - } - - // Generate tree from LeveledList. - root := pterm.NewTreeFromLeveledList(leveledList) - - // Render TreePrinter - pterm.DefaultTree.WithRoot(root).Render() -}