MCPcopy
hub / github.com/jedib0t/go-pretty

github.com/jedib0t/go-pretty @v6.8.2 sqlite

repository ↗ · DeepWiki ↗ · release v6.8.2 ↗
977 symbols 4,370 edges 109 files 293 documented · 30%
README

go-pretty

Go Reference Build Status Coverage Status Go Report Card Quality Gate Status

Utilities to prettify console output of tables, lists, progress bars, text, and more with a heavy emphasis on customization and flexibility.

Quick Start

go get github.com/jedib0t/go-pretty/v6

Import the packages you need:

import (
    "github.com/jedib0t/go-pretty/v6/table"
    "github.com/jedib0t/go-pretty/v6/list"
    "github.com/jedib0t/go-pretty/v6/progress"
    "github.com/jedib0t/go-pretty/v6/text"
)

Note: Current major version is v6. See Go modules versioning for details.

Packages

Table

Pretty-print tables with colors, auto-merge, sorting, paging, and multiple output formats (ASCII, HTML, Markdown, CSV, TSV).

+-----+------------+-----------+--------+-----------------------------+
|   # | FIRST NAME | LAST NAME | SALARY |                             |
+-----+------------+-----------+--------+-----------------------------+
|   1 | Arya       | Stark     |   3000 |                             |
|  20 | Jon        | Snow      |   2000 | You know nothing, Jon Snow! |
| 300 | Tyrion     | Lannister |   5000 |                             |
+-----+------------+-----------+--------+-----------------------------+
|     |            | TOTAL     |  10000 |                             |
+-----+------------+-----------+--------+-----------------------------+

Try the nested colored tables demo:

go run github.com/jedib0t/go-pretty/v6/cmd/demo-table@latest colors

Tables with Colors within a Table in a Terminal

📖 Full documentation →

Progress

Track progress of one or more tasks with ETA, speed calculation, indeterminate indicators, and customizable styles.

Progress Demo in a Terminal

📖 Full documentation →

List

Pretty-print hierarchical lists with multiple levels, indentation, and multiple output formats (ASCII, HTML, Markdown).

╭─ Game Of Thrones
│  ├─ Winter
│  ├─ Is
│  ╰─ Coming
│     ├─ This
│     ├─ Is
│     ╰─ Known
╰─ The Dark Tower
   ╰─ The Gunslinger

📖 Full documentation →

Text

Utility functions to manipulate strings/text with full ANSI escape sequence support. Used extensively by other packages in this repo.

Features: Alignment (horizontal/vertical), colors & formatting, cursor control, text transformation (case, JSON, time, URLs), string manipulation (pad, trim, wrap), and more.

📖 Full documentation →

Extension points exported contracts — how you extend this code

Pager (Interface)
Pager lets you interact with the table rendering in a paged manner. [1 implementers]
table/pager.go
IndeterminateIndicatorGenerator (FuncType)
IndeterminateIndicatorGenerator is a function that takes the maximum length of the progress bar and returns an Indetermi
progress/indicator.go
UnitsFormatter (FuncType)
UnitsFormatter defines a function that prints a value in a specific style.
progress/units.go
Writer (Interface)
Writer declares the interfaces that can be used to set up and render a Progress tracker with one or more trackers.
progress/writer.go
RowPainter (FuncType)
RowPainter is a custom function that takes a Row as input and returns the text.Colors{} to use on the entire row
table/row.go
PagerOption (FuncType)
PagerOption helps control Paging.
table/pager_options.go
WidthEnforcer (FuncType)
WidthEnforcer is a function that helps enforce a width condition on a string.
table/util.go
Writer (Interface)
Writer declares the interfaces that can be used to set up and render a table.
table/writer.go

Core symbols most depended-on inside this repo

AppendRow
called by 185
table/writer.go
Sprint
called by 132
text/color.go
Render
called by 107
table/writer.go
NewWriter
called by 107
table/writer.go
Apply
called by 106
text/align.go
Sprintf
called by 101
text/color.go
AppendHeader
called by 93
table/writer.go
AppendFooter
called by 77
table/writer.go

Shape

Function 469
Method 427
Struct 45
TypeAlias 25
FuncType 7
Interface 4

Languages

Go100%

Modules by API surface

table/table.go62 symbols
progress/render_test.go42 symbols
text/color_test.go36 symbols
progress/progress.go35 symbols
table/writer.go34 symbols
table/render_test.go32 symbols
progress/tracker_sort.go32 symbols
progress/writer.go31 symbols
progress/render.go30 symbols
progress/progress_test.go28 symbols
text/string_test.go27 symbols
progress/tracker.go27 symbols

Dependencies from manifests, versioned

github.com/google/pprofv0.0.0-2024022716375 · 1×
github.com/mattn/go-runewidthv0.0.16 · 1×
github.com/pkg/profilev1.7.0 · 1×
github.com/pmezard/go-difflibv1.0.0 · 1×
github.com/rivo/unisegv0.4.7 · 1×
golang.org/x/sysv0.30.0 · 1×
golang.org/x/termv0.29.0 · 1×
golang.org/x/textv0.22.0 · 1×
gopkg.in/yaml.v3v3.0.1 · 1×

For agents

$ claude mcp add go-pretty \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact