Tabby

超简单 Golang 表格的小型库。「A tiny library for super simple Golang tables」

  • 所有者: cheynewallace/tabby
  • 平台: Linux,Mac,Windows
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

cover.run
Mentioned in Awesome Go

Tabby

A tiny library for super simple Golang tables

Get Tabby

go get github.com/cheynewallace/tabby

Import Tabby

import "github.com/cheynewallace/tabby"

Tabby is a tiny (around 70 lines of code) efficient libary for writing extremely simple table based terminal output in Golang.

Many table libraries out there are overly complicated and packed with features you don't need. If you simply want to write clean output to your terminal in table format with minimal effort, Tabby is for you.

Typical examples

  • Writing simple tables with heading and tab spaced columns
  • Writing log lines to the terminal with evenly spaced columns

Example With Heading

t := tabby.New()
t.AddHeader("NAME", "TITLE", "DEPARTMENT")
t.AddLine("John Smith", "Developer", "Engineering")
t.Print()

Output

NAME        TITLE      DEPARTMENT
----        -----      ----------
John Smith  Developer  Engineering

Example Without Heading

t := tabby.New()
t.AddLine("Info:", "WEB", "Success 200")
t.AddLine("Info:", "API", "Success 201")
t.AddLine("Error:", "DATABASE", "Connection Established")
t.Print()

Output

Info:   WEB       Success 200
Info:   API       Success 201
Error:  DATABASE  Connection Established

Example With Custom tabWriter

w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
t := tabby.NewCustom(w)

Full Example

package main

import "github.com/cheynewallace/tabby"

func main() {
	t := tabby.New()
	t.AddHeader("NAME", "TITLE", "DEPARTMENT")
	t.AddLine("John Smith", "Developer", "Engineering")
	t.Print()
}

主要指標

概覽
名稱與所有者cheynewallace/tabby
主編程語言Go
編程語言Go (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2018-12-17 23:35:39
推送於2020-12-23 01:20:33
最后一次提交2020-12-23 12:19:22
發布數3
最新版本名稱v1.1.1 (發布於 )
第一版名稱v1.0.0 (發布於 )
用户参与
星數358
關注者數2
派生數19
提交數24
已啟用問題?
問題數6
打開的問題數3
拉請求數2
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?