💻 PTerm | Pretty Terminal Printer A golang module to print pretty text

Overview

💻 PTerm | Pretty Terminal Printer

A golang module to print pretty text

Latest Release Stars Forks Issues License: MIT
Downloads
Downloads Forks PTerm

Show Demo Code



PTerm.sh | Installation | Documentation | Quick Start | Examples | Q&A | Contributing


⭐ Main Features

🥅 Goal of PTerm

PTerm is designed to create a platform independent way to create beautiful terminal output. Most modules that want to improve the terminal output do not guarantee platform independence - PTerm does. PTerm follows the most common methods for displaying color in a terminal. With PTerm, it is possible to create beautiful output even in low-level environments.

• 🪀 Easy to use

Our first priority is to keep PTerm as easy to use as possible. With many examples for each individual component, getting started with PTerm is extremely easy. All components are similar in design and implement interfaces to simplify mixing individual components together.

• 🤹‍♀️ Cross-Platform

We take special precautions to ensure that PTerm works on as many operating systems and terminals as possible. Whether it's Windows CMD, macOS iTerm2 or in the backend (for example inside a GitHub Action or other CI systems), PTerm guarantees beautiful output!

PTerm is actively tested on Windows, Linux (Debian & Ubuntu) and macOS.

• 🧪 Well tested

PTerm has a 100% test coverage, which means that every line of code inside PTerm gets tested automatically

We test PTerm continuously. However, since a human cannot test everything all the time, we have our own test system with which we currently run 5453 automated tests to ensure that PTerm has no bugs.

• ✨ Consistent Colors

PTerm uses the ANSI color scheme which is widely used by terminals to ensure consistent colors in different terminal themes. If that's not enough, PTerm can be used to access the full RGB color scheme (16 million colors) in terminals that support TrueColor.

ANSI Colors

• 📚 Component system

PTerm consists of many components, called Printers, which can be used individually or together to generate pretty console output.

• 🛠 Configurable

PTerm can be used by without any configuration. However, you can easily configure each component with little code, so everyone has the freedom to design their own terminal output.

⚠ NOTICE

PTerm is currently under development. It is very likely that not all things will remain as they are at the moment. However, PTerm is still functional. The versioning of PTerm follows the SemVer guidelines. Breaking Changes are explicitly mentioned in the changelogs and the version will be increased accordingly. Everybody is welcome to improve PTerm, whether by making suggestions or pull requests. Thanks ❤

If you want to wait for a stable release, make sure to star the project and follow it, to get notified when we release v1.0.0 (stable) 🚀

📦 Installation

To make PTerm available in your project, you can run the following command.
Make sure to run this command inside your project, when you're using go modules 😉

go get github.com/pterm/pterm

✏ Documentation

To view the official documentation of the latest release, you can go to the automatically generated page of pkg.go.dev This documentation is very technical and includes every method that can be used in PTerm.

For an easy start we recommend that you take a look at the examples section. Here you can see pretty much every feature of PTerm with its source code. The animations of the examples are automatically updated as soon as something changes in PTerm.

Have fun exploring this project 🚀

💖 Contributing

If you have found a bug or want to suggest a feature, you can do so here by opening a new issue.

If you want to contribute to the development of PTerm, you are very welcome to do so. Our contribution guidelines can be found here.

💕 Support

If you want to support me in further developing my open source projects, you can give me a little tip 😄
Your financial support enables me to focus more on my projects. Thank you very much!
Buy Me A Coffee

🧪 Examples

You can find all the examples, with their source code, here: ./_examples

barchart

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	bars := pterm.Bars{
		pterm.Bar{
			Label: "Bar 1",
			Value: 5,
		},
		pterm.Bar{
			Label: "Bar 2",
			Value: 3,
		},
		pterm.Bar{
			Label: "Longer Label",
			Value: 7,
		},
	}

	_ = pterm.DefaultBarChart.WithBars(bars).Render()
	_ = pterm.DefaultBarChart.WithHorizontal().WithBars(bars).Render()
}

bigtext

Animation

SHOW SOURCE
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()
}

box

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	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.Sprint("Ut enim ad minim veniam,\nquis nostrud exercitation\nullamco laboris\nnisi ut aliquip\nex ea commodo\nconsequat.")
	panel3 := pterm.DefaultBox.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.WithRightPadding(0).WithBottomPadding(0).Println(panels)
}

bulletlist

Animation

SHOW SOURCE
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()
}

bulletlist-custom

Animation

SHOW SOURCE
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()
}

center

Animation

SHOW SOURCE
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")
}

demo

Animation

SHOW SOURCE
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.Title = "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
}

disable-color

Animation

SHOW SOURCE
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.Title = "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
}

disable-output

Animation

SHOW SOURCE
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)
	}
}

header

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print a default header.
	pterm.DefaultHeader.Println("This is the default header!")
}

header-custom

Animation

SHOW SOURCE
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!")
}

override-default-printers

Animation

SHOW SOURCE
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")
}

panel

Animation

SHOW SOURCE
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()
}

paragraph

Animation

SHOW SOURCE
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")
}

paragraph-custom

Animation

SHOW SOURCE
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")
}

prefix

Animation

SHOW SOURCE
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.
}

print-basic-text

Animation

SHOW SOURCE
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!")
}

print-color-fade

Animation

SHOW SOURCE
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!")
	}
}

print-color-fade-multiple

Animation

SHOW SOURCE
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!")
	}
}

print-color-rgb

Animation

SHOW SOURCE
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!")
}

print-with-color

Animation

SHOW SOURCE
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")
}

progressbar

Animation

SHOW SOURCE
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.Title = "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.
	}
}

section

Animation

SHOW SOURCE
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")
}

spinner

Animation

SHOW SOURCE
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 * 3) // 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 * 3) // 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 * 3) // 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 * 2)                      // Simulate 2 seconds of processing something.
	spinnerLiveText.UpdateText("It's really much")   // Update spinner text.
	time.Sleep(time.Second * 2)                      // Simulate 2 seconds of processing something.
	spinnerLiveText.UpdateText("We're nearly done!") // Update spinner text.
	time.Sleep(time.Second * 2)                      // Simulate 2 seconds of processing something.
	spinnerLiveText.Success("Finally!")              // Resolve spinner with success message.
}

table

Animation

SHOW SOURCE
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", "[email protected]"},
		{"Callie", "Mckay", "[email protected]"},
		{"Libby", "Camacho", "[email protected]"},
	}).Render()
}

theme

Animation

SHOW SOURCE
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)
		}
	}
}

tree

Animation

SHOW SOURCE
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()
}

GitHub @pterm  ·  Author @MarvinJWendt | PTerm.sh

Comments
  • feat: added a custom writer for all text printers

    feat: added a custom writer for all text printers

    Description

    Add custom writer support for most of the printers except for the area_printer

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [x] New Feature
    • [ ] Documentation
    • [ ] Other

    Related Issue

    Fixes #261

    To-Do Checklist

    • [ ] I tested my changes
    • [ ] I have commented every method that I created/changed
    • [ ] I updated the examples to fit with my changes
    • [ ] I have added tests for my newly created methods
    feature 
    opened by Brookke 16
  • feat: adding interactive continue printer

    feat: adding interactive continue printer

    Description

    Adding a new interactive printer, it's very similar to the confirmation printer but allows for multiple options.

    $ go run main.go                                           
    Do you want to continue [Y/n/a/s]: 
    
     INFO  You answered: no
    

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [x] New Feature
    • [ ] Documentation
    • [ ] Other

    To-Do Checklist

    • [x] I tested my changes
    • [x] I have commented every method that I created/changed
    • [x] I updated the examples to fit with my changes
    • [x] I have added tests for my newly created methods
    feature 
    opened by luisdavim 15
  • fix: Added possibility to correctly handle negative values for charts

    fix: Added possibility to correctly handle negative values for charts

    Description

    I've tried this great project for data visualization and found out that negative values are ignored while chart rendering. So I decided to add such feature. To provide best user experience, my chart canvas is adaptive - if chart has only positive values you will not see negative part of chart and vise versa. This way we effectively use available screen area. And only if data includes both negative and positive values, chart will be rendered form two parts - top (or right) for positive and bottom (or left) for negative.

    Scope

    Barchart, examples for barchart, and also I needed to update tests with new expected data, because negative bars now actually displayed so they cannot pass current tests.

    • [ ] Bug Fix
    • [X] New Feature
    • [ ] Documentation
    • [ ] Other

    Related Issue

    Fixes #

    To-Do Checklist

    • [X] I tested my changes
    • [X] I have commented every method that I created/changed
    • [X] I updated the examples to fit with my changes
    • [ ] I have added tests for my newly created methods (I didn't create new methods, just actualized tests for current ones)
    feature 
    opened by anxp 15
  • test: snapshots for content tests

    test: snapshots for content tests

    Description

    Snapshots for various content-related tests (35):

    • Render()
    • GetContent()
    • AssertContains()

    Not covered:

    • ...NilPrint()
    • test?Print??Contains()

    Also skipped for now are tests without assertions, eg TestAreaPrinter_RemoveWhenDone. It may be a good idea to cover them as well.

    TODO - Depends on fixed testza snapshots. Currently theres a local module replace in go.mod, which has to be removed before merging.

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [ ] New Feature
    • [ ] Documentation
    • [x] Other

    Related Issue

    Fixes #246

    To-Do Checklist

    • [x] I tested my changes
    • [ ] N/A I have commented every method that I created/changed
    • [ ] N/A I updated the examples to fit with my changes
    • [ ] N/A I have added tests for my newly created methods
    opened by TobiaszCudnik 13
  • boxed table - style is not reset between cells

    boxed table - style is not reset between cells

    Hi. Thank you for this great project.

    I notice that when a cell contains a string formated with style (i.e bold or italic), the next cell is "infected" with the same style. This is only reproducible in boxed mode.

    concider the following code:

    func TestBox(t *testing.T) {
    	line := pterm.Italic.Sprint("italic")
    
    
    	table, _ := pterm.DefaultTable.WithBoxed().WithData(
    		[][]string{
    			{line, "a", "b", "c"},
    		}).Srender()
    
    	fmt.Println(table)
    
    	table, _ = pterm.DefaultTable.WithData(
    		[][]string{
    			{line, "a", "b", "c"},
    		}).Srender()
    
    	fmt.Println(table)
    
    	pterm.DefaultBox.Println(table)
    }
    
    

    I get the following. You can see that the normal table renders fine, but in box-mode - all the rest of the line is italic.

    Screenshot from 2021-07-29 01-43-51

    This is probably a problem with BoxPrinter, as you can see with:

    pterm.DefaultBox.Println("normal", pterm.Bold.Sprint("bold."), "this should not be bold\nnewline fixes")
    

    Thank you.

    bug critical 
    opened by kjellkvinge 11
  • Printers prefixes with same width

    Printers prefixes with same width

    Hello there,

    I was wondering if it might possible to make all the Printers prefixes with the same width? Right now it looks like this:

    Capture d’écran 2021-10-09 à 18 59 58

    If the width was the same for every kind of prefix, the alignment would look much nicer.

    Thanks!

    proposal 
    opened by kinoute 8
  • Add spaces between operands by default

    Add spaces between operands by default

    Hi Marvin,

    This is the FR as per our discussion (linked at the end).

    One thing that I noticed is the following:

    When I run

    package main
    
    import (
    	"fmt"
    )
    
    func main() {
    	const name, age = "Kim", 22
    	fmt.Println(name, "is", age, "years old.")
    }
    

    I get

    Kim is 22 years old.

    while

    package main
    
    import (
    	"github.com/pterm/pterm"
    )
    
    func main() {
    	const name, age = "Kim", 22
    	pterm.Println(name, "is", age, "years old.")
    }
    

    produces

    Kimis22years old.

    The example is taken from Golang's documentation here which states "Spaces are always added between operands".

    Thanks!

    Originally posted by @m5lk3n in https://github.com/pterm/pterm/discussions/66#discussioncomment-269543

    bug proposal in progress 
    opened by m5lk3n 8
  • feat: custom writer for progressbar and spinner printers

    feat: custom writer for progressbar and spinner printers

    Description

    Adds a custom writer to the progress bar and spinner components.

    Scope

    What is affected by this pull request? ProgressBar and Spinner

    • [ ] Bug Fix
    • [x] New Feature
    • [ ] Documentation
    • [ ] Other

    Related Issue

    Fixes #261

    To-Do Checklist

    • [ ] I tested my changes
    • [x] I have commented every method that I created/changed
    • [ ] I updated the examples to fit with my changes
    • [x] I have added tests for my newly created methods
    feature 
    opened by Brookke 7
  • feat: group tables before rendering

    feat: group tables before rendering

    Description

    It's very early probably with bugs approach on grouping printers together and share styling across them.

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [x] New Feature
    • [ ] Documentation
    • [ ] Other

    Related Issue

    Proposal #224

    To-Do Checklist

    • [x] I tested my changes
    • [x] I have commented every method that I created/changed
    • [ ] I updated the examples to fit with my changes
    • [x] I have added tests for my newly created methods
    opened by KarolosLykos 7
  • feat(table): add support for right data alignment

    feat(table): add support for right data alignment

    Description

    Add support for right data alignment. By default, the table data will be left-aligned.

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [X] New Feature
    • [ ] Documentation
    • [ ] Other

    Related Issue

    Fixes https://github.com/pterm/pterm/issues/216

    To-Do Checklist

    • [x] I tested my changes
    • [x] I have commented on every method that I created/changed
    • [x] I updated the examples to fit with my changes
    • [x] I have added tests for my newly created methods
    opened by rizalgowandy 7
  • feat(progressbar): made updating the progressbar title easier.

    feat(progressbar): made updating the progressbar title easier.

    Description

    Decouple the rendering logic from the Add() method, this allows updating the title without the need of Add().

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [ ] New Feature
    • [ ] Documentation
    • [x] Other

    Related Issue

    Fixes #174

    To-Do Checklist

    • [x] I tested my changes
    • [x] I have commented every method that I created/changed
    • [x] I updated the examples to fit with my changes
    • [x] I have added tests for my newly created methods
    opened by b4sen 7
  • chore(deps): bump golang.org/x/text from 0.4.0 to 0.5.0

    chore(deps): bump golang.org/x/text from 0.4.0 to 0.5.0

    Bumps golang.org/x/text from 0.4.0 to 0.5.0.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies ignore-for-release 
    opened by dependabot[bot] 1
  • Concurrency issue in spinner_printer

    Concurrency issue in spinner_printer

    There's a new goroutine accesing shared states like IsActive,ShowTimer in SpinnerPrinter#start. This causes race issue when calling other functions like "Stop" after the printer is started.

    https://github.com/pterm/pterm/blob/master/spinner_printer.go#L140

    bug 
    opened by niczy 3
  • Area Update after `return` / or when typing in the terminal

    Area Update after `return` / or when typing in the terminal

    I'm not sure whether it's a feature request or a bug report. I'm using the Area component (which renders a dynamic table) along with some interactive inputs which require a user input on the command line (not part of this library). Whenever the area renders, the cursor will move back to the beginning of the line. Also, if the user creates a new line in the terminal (by clicking on return), it will break the table (see below).

    Simple example is just to use the clock of the example, then click a few times on return

    area, _ := pterm.DefaultArea.Start() // Start the Area printer.
    for i := 0; i < 10; i++ {
        str, _ := pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString(time.Now().Format("15:04:05"))).Srender() // Save current time in str.
        str = pterm.DefaultCenter.Sprint(str) // Center str.
        area.Update(str) // Update Area contents.
        time.Sleep(time.Second)
    }
    area.Stop()
    
    image bug 
    opened by 0cv 3
  • Add an option to change checkmarks in the interactive multiselect

    Add an option to change checkmarks in the interactive multiselect

    I've run into an issue where Windows console isn't able to render the default multiselect's checkmarks ("✓" and "✗") due to them being undefined in the standard "Consolas" font. I don't really feel like changing a font nor manually changing anything in the PTerm's source code. An option to define them would be a great addition to this awesome project.

    proposal proposal-accepted 
    opened by xMajkel 1
  • refactor(interactive_printers): change `DefaultText` to `Label` on InteractiveConfirm and InteractiveMultiselect

    refactor(interactive_printers): change `DefaultText` to `Label` on InteractiveConfirm and InteractiveMultiselect

    Description

    Changed DefaultText and TextStyle to Label and LabelStyle on InteractiveConfirm and InteractiveMultiselect. Deprecated methods with old names

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [ ] New Feature
    • [ ] Documentation
    • [X] Other

    Related Issue

    Fixes #405

    To-Do Checklist

    • [X] I tested my changes
    • [X] I have commented every method that I created/changed
    • [X] I updated the examples to fit with my changes
    • [X] I have added tests for my newly created methods
    breaking hacktoberfest-accepted 
    opened by VictorAssunc 2
Releases(v0.12.51)
  • v0.12.51(Dec 24, 2022)

    What's Changed

    Fixes 🔧

    • Make sure the confirm printer can clean up after Ctrl+C by @adombeck in https://github.com/pterm/pterm/pull/425
    • Use the correct given style for the InteractiveSelectPrinter instead of the default theme. by @sephiroth74 in https://github.com/pterm/pterm/pull/426

    New Contributors

    • @sephiroth74 made their first contribution in https://github.com/pterm/pterm/pull/426

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.50...v0.12.51

    Source code(tar.gz)
    Source code(zip)
  • v0.12.50(Nov 22, 2022)

    What's Changed

    Fixes 🔧

    • fix: slice bounds out of range on select printer by @mponton in https://github.com/pterm/pterm/pull/420

    Other Changes

    • chore(ci): remove macos from matrix by @rafaelrubbioli in https://github.com/pterm/pterm/pull/412

    New Contributors

    • @rafaelrubbioli made their first contribution in https://github.com/pterm/pterm/pull/412
    • @mponton made their first contribution in https://github.com/pterm/pterm/pull/420

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.49...v0.12.50

    Source code(tar.gz)
    Source code(zip)
  • v0.12.49(Oct 3, 2022)

    What's Changed

    Fixes 🔧

    • fixed #352 by @MarvinJWendt in https://github.com/pterm/pterm/pull/409

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.48...v0.12.49

    Source code(tar.gz)
    Source code(zip)
  • v0.12.48(Oct 1, 2022)

    What's Changed

    Exciting New Features 🎉

    • Customizable multiselect printer by @jochil in https://github.com/pterm/pterm/pull/402

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.47...v0.12.48

    Source code(tar.gz)
    Source code(zip)
  • v0.12.47(Sep 26, 2022)

    What's Changed

    Exciting New Features 🎉

    • feat: adding interactive continue printer by @luisdavim in https://github.com/pterm/pterm/pull/384

    Other Changes

    • bumped go.mod to 1.18 by @MarvinJWendt in https://github.com/pterm/pterm/pull/404

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.46...v0.12.47

    Source code(tar.gz)
    Source code(zip)
  • v0.12.46(Sep 5, 2022)

    What's Changed

    Exciting New Features 🎉

    • feat(putils): add CenterText in putils by @floaust in https://github.com/pterm/pterm/pull/399

    Fixes 🔧

    • fix(textinput): fixed overwriting the default values by @MarvinJWendt in https://github.com/pterm/pterm/pull/398

    Other Changes

    • Fixed no newline on TextinputPrinter by @MarvinJWendt in https://github.com/pterm/pterm/pull/389
    • fix index out of range in InteractiveMultiselectPrinter by @adombeck in https://github.com/pterm/pterm/pull/393

    New Contributors

    • @adombeck made their first contribution in https://github.com/pterm/pterm/pull/393

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.45...v0.12.46

    Source code(tar.gz)
    Source code(zip)
  • v0.12.45(Jul 26, 2022)

    What's Changed

    Fixes 🔧

    • fix: the interactive confirm answers should match the confirm/reject text by @luisdavim in https://github.com/pterm/pterm/pull/382
    • fix: make sure the interactive printers can cleanup after Ctrl+C by @jochil in https://github.com/pterm/pterm/pull/383

    New Contributors

    • @luisdavim made their first contribution in https://github.com/pterm/pterm/pull/382
    • @jochil made their first contribution in https://github.com/pterm/pterm/pull/383

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.44...v0.12.45

    Source code(tar.gz)
    Source code(zip)
  • v0.12.44(Jul 22, 2022)

    What's Changed

    Exciting New Features 🎉

    • Adds InfoPrinter in SpinnerPrinter by @orobardet in https://github.com/pterm/pterm/pull/380

    New Contributors

    • @orobardet made their first contribution in https://github.com/pterm/pterm/pull/380

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.43...v0.12.44

    Source code(tar.gz)
    Source code(zip)
  • v0.12.43(Jul 22, 2022)

    What's Changed

    Fixes 🔧

    • fix(spinner): fix line didn't clear properly by @floaust in https://github.com/pterm/pterm/pull/375
    • fix(table): fixed column length calculation for Chinese strings by @opsnull in https://github.com/pterm/pterm/pull/378

    New Contributors

    • @opsnull made their first contribution in https://github.com/pterm/pterm/pull/378

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.42...v0.12.43

    Source code(tar.gz)
    Source code(zip)
  • v0.12.42(Jun 21, 2022)

    PTerm got its own docs site! 📖

    --> https://docs.pterm.sh <--

    We now feature interactive printers! 🥳🎉

    PTerm interactive multiselect menu

    More here: https://docs.pterm.sh/printers/interactive

    What's Changed

    Exciting New Features 🎉

    • feat: custom writer for progressbar and spinner printers by @Brookke in https://github.com/pterm/pterm/pull/337
    • Moved NewLettersFromString and NewLettersFromStringWithStyle to putils by @MarvinJWendt in https://github.com/pterm/pterm/pull/364
    • Moved NewBulletListXxx to putils by @MarvinJWendt in https://github.com/pterm/pterm/pull/365
    • Moved NewTreeFromLeveledList to putils by @MarvinJWendt in https://github.com/pterm/pterm/pull/369
    • Moved NewRGBFromHex to putils by @MarvinJWendt in https://github.com/pterm/pterm/pull/370
    • Added interactive printers 🎉🥳 by @MarvinJWendt in https://github.com/pterm/pterm/pull/360

    Other Changes

    • ci: fixed automatic docs updates by @MarvinJWendt in https://github.com/pterm/pterm/pull/347
    • new example structure by @MarvinJWendt in https://github.com/pterm/pterm/pull/349
    • CI System now runs faster by @MarvinJWendt in https://github.com/pterm/pterm/pull/357

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.41...v0.12.42

    Source code(tar.gz)
    Source code(zip)
  • v0.12.41(Apr 12, 2022)

    What's Changed

    Fixes 🔧

    • [putils] Don't stop already stopped spinners by @MarvinJWendt in https://github.com/pterm/pterm/pull/342

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.40...v0.12.41

    Source code(tar.gz)
    Source code(zip)
  • v0.12.40(Mar 28, 2022)

    What's Changed

    Exciting New Features 🎉

    • feat: added a custom writer for all text printers by @Brookke in https://github.com/pterm/pterm/pull/324

    New Contributors

    • @Brookke made their first contribution in https://github.com/pterm/pterm/pull/324

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.39...v0.12.40

    Source code(tar.gz)
    Source code(zip)
  • v0.12.39(Mar 18, 2022)

    What's Changed

    Exciting New Features 🎉

    • feat: use fallback color in BigTextPrinter when RGB is not supported by @MarvinJWendt in https://github.com/pterm/pterm/pull/331

    Other Changes

    • test: removed snapshot testing by @MarvinJWendt in https://github.com/pterm/pterm/pull/328
    • docs(readme): added discord link to readme by @MarvinJWendt in https://github.com/pterm/pterm/pull/329

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.38...v0.12.39

    Source code(tar.gz)
    Source code(zip)
  • v0.12.38(Mar 9, 2022)

    What's Changed

    Exciting New Features 🎉

    • feat: added NewLettersFromStringWithRGB by @floaust in https://github.com/pterm/pterm/pull/322

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.37...v0.12.38

    Source code(tar.gz)
    Source code(zip)
  • v0.12.37(Feb 17, 2022)

    What's Changed

    Exciting New Features 🎉

    • refactor(putils): Improved styling by @MarvinJWendt in https://github.com/pterm/pterm/pull/313
    • feat(progressbar): Added option to set the MaxWidth of a progressbar by @MarvinJWendt in https://github.com/pterm/pterm/pull/315

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.36...v0.12.37

    Source code(tar.gz)
    Source code(zip)
  • v0.12.36(Feb 2, 2022)

    What's Changed

    Exciting New Features 🎉

    • Added horizontal table header row and row separators by @KarolosLykos in https://github.com/pterm/pterm/pull/304

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.35...v0.12.36

    Source code(tar.gz)
    Source code(zip)
  • v0.12.35(Feb 1, 2022)

    What's Changed

    Exciting New Features 🎉

    • Added possibility to correctly handle negative values for charts by @anxp in https://github.com/pterm/pterm/pull/305

    New Contributors

    • @anxp made their first contribution in https://github.com/pterm/pterm/pull/305

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.34...v0.12.35

    Source code(tar.gz)
    Source code(zip)
  • v0.12.34(Jan 16, 2022)

    What's Changed

    Fixes 🔧

    • Refresh progressbars on every PTerm print (#302) by @MarvinJWendt in https://github.com/pterm/pterm/pull/307

    Other Changes

    • chore(deps): bump github.com/MarvinJWendt/testza from 0.2.10 to 0.2.11 by @dependabot in https://github.com/pterm/pterm/pull/288
    • ci: fixed flaky tests on linux/macos by @TobiaszCudnik in https://github.com/pterm/pterm/pull/290
    • chore(deps): bump github.com/MarvinJWendt/testza from 0.2.11 to 0.2.12 by @dependabot in https://github.com/pterm/pterm/pull/293
    • test: removed AreaPrinter test output by @MarvinJWendt in https://github.com/pterm/pterm/pull/294
    • ci: added matrix tests for windows, linux and darwin by @MarvinJWendt in https://github.com/pterm/pterm/pull/295
    • test: snapshots for content tests by @TobiaszCudnik in https://github.com/pterm/pterm/pull/291

    New Contributors

    • @TobiaszCudnik made their first contribution in https://github.com/pterm/pterm/pull/290

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.33...v0.12.34

    Source code(tar.gz)
    Source code(zip)
  • v0.12.33(Oct 25, 2021)

    What's Changed

    • feat: add PrintOnErrorf for every TextPrinter by @KarolosLykos in https://github.com/pterm/pterm/pull/279
    • chore(deps): bump github.com/MarvinJWendt/testza from 0.2.9 to 0.2.10 by @dependabot in https://github.com/pterm/pterm/pull/283
    • feat(table): add support for right data alignment by @rizalgowandy in https://github.com/pterm/pterm/pull/269
    • feat(progressbar): made updating the progressbar title easier. by @b4sen in https://github.com/pterm/pterm/pull/267

    New Contributors

    • @rizalgowandy made their first contribution in https://github.com/pterm/pterm/pull/269
    • @b4sen made their first contribution in https://github.com/pterm/pterm/pull/267

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.32...v0.12.33

    Source code(tar.gz)
    Source code(zip)
  • v0.12.32(Oct 19, 2021)

    What's Changed

    • chore(deps): bump github.com/MarvinJWendt/testza from 0.2.8 to 0.2.9 by @dependabot in https://github.com/pterm/pterm/pull/260
    • feat: added AreaPrinter.Clear() by @GibranHL0 in https://github.com/pterm/pterm/pull/265
    • docs(area): added Clear method to docs by @nishant-giri in https://github.com/pterm/pterm/pull/268
    • fix: progressbar method name by @kinoute in https://github.com/pterm/pterm/pull/272
    • fix(header): fixed length calculation for Chinese strings by @MarvinJWendt in https://github.com/pterm/pterm/pull/276
    • refactor: fixes the 'bitSize' argument is invalid, must be either 32 or 64 linter error by @KarolosLykos in https://github.com/pterm/pterm/pull/278

    New Contributors

    • @GibranHL0 made their first contribution in https://github.com/pterm/pterm/pull/265
    • @nishant-giri made their first contribution in https://github.com/pterm/pterm/pull/268
    • @kinoute made their first contribution in https://github.com/pterm/pterm/pull/272
    • @KarolosLykos made their first contribution in https://github.com/pterm/pterm/pull/278

    Full Changelog: https://github.com/pterm/pterm/compare/v0.12.31...v0.12.32

    Source code(tar.gz)
    Source code(zip)
  • v0.12.31(Sep 21, 2021)

  • v0.12.30(Aug 16, 2021)

  • v0.12.29(Jul 21, 2021)

    Features

    • putils: add PrintAverageExecutionTime

    Test

    • fix rgb error test
    • fix internal test import cycle
    • move tests into own package

    Code Refactoring

    • replace testify with testza
    Source code(tar.gz)
    Source code(zip)
  • v0.12.28(Jul 17, 2021)

    Features

    • spinner: add option to show a timer

    Bug Fixes

    • bar chart: fix panic when rendering empty horizontal bar chart

    Test

    • spinner: try to fix RawOutput test
    • spinner: add raw output test

    Code Refactoring

    • spinner: better raw output logic
    • spinner: refactor
    Source code(tar.gz)
    Source code(zip)
  • v0.12.27(Jul 5, 2021)

  • v0.12.26(Jul 1, 2021)

  • v0.12.25(Jul 1, 2021)

  • v0.12.24(Jun 14, 2021)

    Features

    • boxprinter: replace line breaks in title with space
    • boxprinter: add title center position to BoxPrinter
    • boxprinter: add title & title position to BoxPrinter
    • boxprinter: add title & title position to BoxPrinter
    • putils: add TableDataFromSeparatedValues
    • putils: add TableDataFromTSV
    • putils: add TableDataFromCSV
    • putils: add function to convert TSV to TableData
    • putils: add function to convert CSV to TableData
    Source code(tar.gz)
    Source code(zip)
  • v0.12.23(Jun 7, 2021)

  • v0.12.22(May 30, 2021)

Owner
✨ A modern go module to beautify console output. Featuring charts, progressbars, tables, trees and many more 🚀 It's completely configurable and cross-platform!
null
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.

?? Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染

Gookit 1.2k Dec 30, 2022
Print day progress in your terminal

Day progress Print day progress in your terminal Install go install github.com/tsivinsky/[email protected] Usage day-progress By default, day-progre

Daniil Tsivinsky 0 Jan 10, 2022
null 0 Jan 27, 2022
🔹 Golang module to move the terminal cursor in any direction on every operating system.

AtomicGo | cursor Get The Module | Documentation | Contributing | Code of Conduct Description Package cursor contains cross-platform methods to move t

AtomicGo 55 Dec 22, 2022
A modern and intuitive terminal-based text editor

micro is a terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the capabilities of modern terminals

Zachary Yedidia 20.9k Jan 7, 2023
Use go to count file's lines and print them.

用法 go run staticCodeLine.go -p [root path] -s [suffix name] -e [exclude dirs] 如果 -e 有多个参数,多次输入 -e [suffix name]。 ╰─± go run statisticCodeLine.go -p /U

null 1 Dec 12, 2022
This CLI tool sends HTTP GET requests and print MD5 hash values of the response's body

HTTP Body Hash Generator This CLI (Command Line Interface) tool sends HTTP GET requests and print MD5 hash values of the response's body. Usage You ne

Uğur Kınık 0 Feb 10, 2022
code is pretty self explanatory and decently commented

square_approximation code is pretty self explanatory and decently commented when limit set to 10^9 or more ram usage goes to >42 gigs of ram which is

null 0 Apr 7, 2022
Gofetch is a pretty command-line "Go and System information" tool written in Go

GoFetch Show off your Go information with this cool command-line tool! Report Bug || Request Feature Table of Contents About the Project Built With Ge

null 77 Nov 1, 2022
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.

Stonks is a terminal based stock visualizer and tracker. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Eric Moynihan 518 Dec 16, 2022
Sense your go module as iTerm2 tab colours

Synesthesia updates your iTerm2 tab colours depending on the go module name in your directory ancestry.

Rory Quinn 8 Aug 10, 2022
Command-line tools for the FFS module.

Command-line tools for FFS The blobd tool defines a JSON-RPC service that implements the FFS blob store interface over various underlying key-value st

M. J. Fromberger 1 Dec 14, 2022
go-editor is the clean go module that refractors from Kubernetes to help you edit resources in a command-line way.

go-editor The source code of go-editor comes from Kubernetes and refractor as the clean Go module. You can embed go-editor in your command-line tool l

Yong 0 Dec 5, 2021
textnote is a command line tool for quickly creating and managing daily plain text notes.

textnote is a command line tool for quickly creating and managing daily plain text notes. It is designed for ease of use to encourage the practice of daily, organized note taking. textnote intentionally facilitates only the management (creation, opening, organizing, and consolidated archiving) of notes, following the philosophy that notes are best written in a text editor and not via a CLI.

Daniel Kaslovsky 162 Jan 2, 2023
Utilities to prettify console output of tables, lists, progress-bars, text, etc.

go-pretty Utilities to prettify console output of tables, lists, progress-bars, text, etc. Table Pretty-print tables into ASCII/Unicode strings.

Naveen Mahalingam 1.6k Dec 29, 2022
word2text - a tool is to convert word documents (DocX) to text on the CLI with zero dependencies for free

This tool is to convert word documents (DocX) to text on the CLI with zero dependencies for free. This tool has been tested on: - Linux 32bit and 64 bit - Windows 32 bit and 64 bit - OpenBSD 64 bit

Ryan Thomas 5 Apr 19, 2021
Interactive CLI helper for creating git branches with JIRA Links and some text

bb (better-branch) Interactive CLI helper for creating git branches with JIRA Links and some text Still in development? Yes How it works? This tiny ut

Eugene Uvarov 3 Aug 18, 2022
A command line http test tool. Maintain the case via git and pure text

httptest A command line http test tool Maintain the api test cases via git and pure text We want to test the APIs via http requests and assert the res

wklken 13 Dec 16, 2022
colorStyle is a library of styles for command-line text.

colorStyle ColorStyle is a library of styles for command-line text. Used to modify the style of text for standard output to the terminal interface, yo

null 5 Nov 12, 2022