uitable

A go library to improve readability in terminal apps using tabular data

  • 所有者: gosuri/uitable
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

uitable GoDoc Build Status

uitable is a go library for representing data as tables for terminal applications. It provides primitives for sizing and wrapping columns to improve readability.

Example Usage

Full source code for the example is available at example/main.go

table := uitable.New()
table.MaxColWidth = 50

table.AddRow("NAME", "BIRTHDAY", "BIO")
for _, hacker := range hackers {
  table.AddRow(hacker.Name, hacker.Birthday, hacker.Bio)
}
fmt.Println(table)

Will render the data as:

NAME          BIRTHDAY          BIO
Ada Lovelace  December 10, 1815 Ada was a British mathematician and writer, chi...
Alan Turing   June 23, 1912     Alan was a British pioneering computer scientis...

For wrapping in two columns:

table = uitable.New()
table.MaxColWidth = 80
table.Wrap = true // wrap columns

for _, hacker := range hackers {
  table.AddRow("Name:", hacker.Name)
  table.AddRow("Birthday:", hacker.Birthday)
  table.AddRow("Bio:", hacker.Bio)
  table.AddRow("") // blank
}
fmt.Println(table)

Will render the data as:

Name:     Ada Lovelace
Birthday: December 10, 1815
Bio:      Ada was a British mathematician and writer, chiefly known for her work on
          Charles Babbage's early mechanical general-purpose computer, the Analytical
          Engine

Name:     Alan Turing
Birthday: June 23, 1912
Bio:      Alan was a British pioneering computer scientist, mathematician, logician,
          cryptanalyst and theoretical biologist

Installation

$ go get -v github.com/gosuri/uitable

Bitdeli Badge

主要指標

概覽
名稱與所有者gosuri/uitable
主編程語言Go
編程語言Makefile (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2015-11-13 21:59:21
推送於2022-10-18 07:02:33
最后一次提交2022-08-26 11:33:36
發布數4
最新版本名稱v0.0.4 (發布於 )
第一版名稱v0.0.1 (發布於 )
用户参与
星數740
關注者數13
派生數33
提交數30
已啟用問題?
問題數9
打開的問題數4
拉請求數11
打開的拉請求數4
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?