uitable

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

  • Owner: gosuri/uitable
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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

Main metrics

Overview
Name With Ownergosuri/uitable
Primary LanguageGo
Program languageMakefile (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2015-11-13 21:59:21
Pushed At2022-10-18 07:02:33
Last Commit At2022-08-26 11:33:36
Release Count4
Last Release Namev0.0.4 (Posted on )
First Release Namev0.0.1 (Posted on )
用户参与
Stargazers Count740
Watchers Count13
Fork Count33
Commits Count30
Has Issues Enabled
Issues Count9
Issue Open Count4
Pull Requests Count11
Pull Requests Open Count4
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private