Skip to content

Instantly share code, notes, and snippets.

@zacksleo
Created February 8, 2021 04:28
Show Gist options
  • Save zacksleo/a1501c2f2531d94cc8488608bf1dd3ec to your computer and use it in GitHub Desktop.
Save zacksleo/a1501c2f2531d94cc8488608bf1dd3ec to your computer and use it in GitHub Desktop.
Cli table for go
package main
import (
"os"
"github.com/tomlazar/table"
)
func main() {
tab := table.Table{
Headers: []string{"姓名", "地址"},
Rows: [][]string{
{"1", "2"},
{"3", "4"},
{"3", "a longer piece of text that should stretch"},
{"but this one is longer", "shorter now"},
},
}
tab.WriteTable(os.Stdout, nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment