Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Table-writer and more in golang!

License

NotificationsYou must be signed in to change notification settings

jedib0t/go-pretty

Repository files navigation

Go ReferenceBuild StatusCoverage StatusGo Report CardQuality Gate Status

Utilities to prettify console output of tables, lists, progress-bars, text, etc.with a heavy emphasis on customization.

Usage

The current major version of this package isv6, and it follows the standardoutlinedhere.

Rungo get github.com/jedib0t/go-pretty/v6 to add this as a dependency to yourproject, and import the packages in your code using one or more of these:

  • github.com/jedib0t/go-pretty/v6/list
  • github.com/jedib0t/go-pretty/v6/progress
  • github.com/jedib0t/go-pretty/v6/table
  • github.com/jedib0t/go-pretty/v6/text

Table

Pretty-print tables in a terminal with colors, nested tables and more.

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

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

Tables with Colors within a Table in a Terminal

More details can be found here:table/

Progress

Track the Progress of one or more Tasks like downloading multiple files inparallel.

Progress Demo in a Terminal

More details can be found here:progress/

List

Pretty-print lists with multiple levels/indents into ASCII/Unicode strings.

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

More details can be found here:list/

Text

Utility functions to manipulate text with or without ANSI escape sequences. Mostof the functions available are used in one or more of the other packages here.

GoDoc has examples for all the available functions.


[8]ページ先頭

©2009-2025 Movatter.jp