go-pretty

Pretty print Tables and more in golang!

Github星跟踪图

go-pretty

Build Status
Coverage Status
Go Report Card
GoDoc

Utilities to prettify console output of tables, lists, text, etc.

Table

Pretty-print tables into ASCII/Unicode strings.

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

Detailed documentation can be found here: table/

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

Detailed documentation can be found here: list/

Progress

Track the Progress of one or more Tasks (like downloading multiple files in
parallel).

Sample Progress Tracking:

Calculating Total   #  1 ... done! [3.25K in 100ms]
Calculating Total   #  2 ... done! [6.50K in 100ms]
Downloading File    #  3 ... done! [9.75KB in 100ms]
Transferring Amount #  4 ... done! [$26.00K in 200ms]
Transferring Amount #  5 ... done! [£32.50K in 201ms]
Downloading File    #  6 ... done! [58.50KB in 300ms]
Calculating Total   #  7 ... done! [91.00K in 400ms]
Transferring Amount #  8 ... 60.9% (●●●●●●●●●●●●●●◌◌◌◌◌◌◌◌◌) [$78.00K in 399.071ms]
Downloading File    #  9 ... 32.1% (●●●●●●●○◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌) [58.50KB in 298.947ms]
Transferring Amount # 10 ... 13.0% (●●○◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌) [£32.50K in 198.84ms]

Detailed documentation can be found here: progress/

Text

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

The unit-tests for each of the above show how these can be used. There GoDoc
should also have examples for all the available functions.

Benchmarks

Partial output of make bench:

BenchmarkList_Render-8            	  200000	      5443 ns/op	     872 B/op	      47 allocs/op
BenchmarkProgress_Render-8        	       5	 300630230 ns/op	    4060 B/op	      90 allocs/op
BenchmarkTable_Render-8           	   20000	     73939 ns/op	    6067 B/op	     197 allocs/op
BenchmarkTable_RenderCSV-8        	  100000	     18680 ns/op	    2977 B/op	      54 allocs/op
BenchmarkTable_RenderHTML-8       	   50000	     27565 ns/op	    4450 B/op	      53 allocs/op
BenchmarkTable_RenderMarkdown-8   	  100000	     20612 ns/op	    2913 B/op	      52 allocs/op

概览

名称与所有者jedib0t/go-pretty
主编程语言Go
编程语言Makefile (语言数: 3)
平台
许可证MIT License
发布数74
最新版本名称v6.5.9 (发布于 )
第一版名称v0.1.0 (发布于 )
创建于2018-04-30 01:54:06
推送于2024-05-05 17:06:51
最后一次提交
星数2.7k
关注者数13
派生数110
提交数200
已启用问题?
问题数107
打开的问题数3
拉请求数198
打开的拉请求数0
关闭的拉请求数13
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?
去到顶部