pterm /pterm
✨ PTerm is a modern Go module to easily beautify console output. Featuring charts, progressbars, tables, trees, text input, select menus and much more 🚀 It's completely configurable and 100% cross-platform compatible.
★ 5,568⑂ 229👁 23⑃ 453● 308▤ 112
+2
日增长
5,568
stars
229
forks
23
watchers
453
prs
308
issues
112
releases
README
💻 PTerm | Pretty Terminal Printer
A modern Go framework to make beautiful CLIs
Show Demo Code
---
PTerm.sh
|
Installation
|
Getting Started
|
Documentation
|
Examples
|
Q&A
|
Discord
---
📦 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 😉
sh
go get github.com/pterm/pterm
⭐ Main Features
| Feature | Description |
|------------------|-----------------------------------------------------|
| 🪀 Easy to use | PTerm emphasizes ease of use, with examples and consistent component design. |
| 🤹♀️ Cross-Platform | PTerm works on various OS and terminals, including Windows CMD, macOS iTerm2, and in CI systems like GitHub Actions. |
| 🧪 Well tested | A high test coverage and 1538 automated tests ensure PTerm's reliability. |
| ✨ Consistent Colors | PTerm uses the ANSI color scheme for uniformity and supports TrueColor for advanced terminals. |
| 📚 Component system | PTerm's flexible Printers can be used individually or combined to generate beautiful console output. |
| 🛠 Configurable | PTerm is ready to use without configuration but allows easy customization for unique terminal output. |
| ✏ Documentation | Access comprehensive docs on pkg.go.dev and view practical examples in the examples section. |
Printers (Components)
| Feature | Feature | Feature | Feature | Feature |
| :-------: | :-------: | :-------: | :-------: | :-------: |
| Area (Examples) |Barchart (Examples) |Basictext (Examples) |Bigtext (Examples) |Box (Examples) |
| Bulletlist (Examples) |Center (Examples) |Coloring (Examples) |Header (Examples) |Heatmap (Examples) |
| Interactive confirm (Examples) |Interactive continue (Examples) |Interactive multiselect (Examples) |Interactive select (Examples) |Interactive textinput (Examples) |
| Logger (Examples) |Multiple-live-printers (Examples) |Panel (Examples) |Paragraph (Examples) |Prefix (Examples) |
| Progressbar (Examples) |Section (Examples) |Slog (Examples) |Spinner (Examples) |Style (Examples) |
| Table (Examples) |Test.sh (Examples) |Theme (Examples) |Tree (Examples) | |
---
🦸♂️ Sponsors
---
🧪 Examples
‼️ You can find all the examples, in a much better structure and their source code, in "_examples" ‼️
Click on the link above to show the examples folder.
area/demo
!Animation
SHOW SOURCE
go
package main
import (
"time"
"github.com/pterm/pterm"
"github.com/pterm/pterm/putils"
)
func main() {
// A live clock: only the area redraws, anything printed before it stays put.
pterm.Info.Println("The previous text will stay in place, while the area updates.")
pterm.Print("\n\n")
area, _ := pterm.DefaultArea.WithCenter().Start()
for range 10 {
// Render the current time as big letters into a string, then swap it
// inTop issues
#255Style problems with East Asia environment13 comments · 2021-09-08#644Make interactive confirm optionally accept return key for confirmation10 comments · 2024-02-19#560Pasting in a string that is 1043 characters during interactive text input causes repeats in prompt9 comments · 2023-08-21#683Don't lose order of array when logging fields8 comments · 2024-09-18#373pterm.sh demo unreadable to people with large font needs7 comments · 2022-06-22#391Spinner is not being removed from the terminal6 comments · 2022-08-22#240Multiple bars for 1 label and different styles for each bar for the bar chart and a legend for the bars6 comments · 2021-07-24#621Update `InteractiveMultiselectPrinter` to optionally show selected options4 comments · 2024-01-22
Discussions
#815v0.12.840 comments · 2026-10-10#768Free changelog automation for pterm — AI-generated changelogs from GitHub releases0 comments · 2026-03-16#720v0.12.810 comments · 2025-06-06#712Do you have an example of how I can customize section0 comments · 2025-02-21#700v0.12.800 comments · 2024-11-27#694Get it to stop stripping newlines?1 comments · 2024-11-05#686How can I achieve multiline printer of spinners but show a log stream under each spinner2 comments · 2024-10-01#664Dynamic Bar Example with just bar just shows one fixed size1 comments · 2024-06-22
Latest release
v0.12.84 v0.12.84 2026-10-10What's Changed Exciting New Features 🎉 feat(logger): preserve slog argument order and add SortArguments option by @ChrisJr404 in https://github.com/pterm/pterm/pull/808 feat(table): add WithColumnMinWidths to set minimum column widths by @ChrisJr404 in https://github.com/pterm/pterm/pull/809 feat: add style to interactive select by @afbjorklund in https://github.com/pterm/pterm/pull/796 feat: make input prompt customizable by @Urban20 in https://github.com/pterm/pterm/pull/810 feat(table): support custom box printer configuration for table rendering by @AdamMagued in https://github