Skip to content

syohex/go-texttable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-texttable

Sample Code

package main

import "github.com/syohex/go-texttable"
import "fmt"

func main () {
	tbl := &texttable.TextTable{}
	tbl.SetHeader("Country", "Capital")

	tbl.AddRow("United States of America", "Washington D.C")
	tbl.AddRow("France", "Paris")
	tbl.AddRow("United Kingdom", "London")
	tbl.AddRow("Japan", "Tokyo")
	tbl.AddRow("Taiwan", "Taipei")

	fmt.Println(tbl.Draw())
}

Output of above code is

go-texttable1

go-texttable also supports multibyte characters such as Japanese.

package main

import "github.com/syohex/go-texttable"
import "fmt"

func main () {
	tbl := &texttable.TextTable{}
	tbl.SetHeader("プログラミング言語", "よみがな", "作者")

	tbl.AddRow("Python", "ぱいそん", "グイド・ヴァンロッサム")
	tbl.AddRow("Perl", "ぱーる", "ラリーウォール")
	tbl.AddRow("Ruby", "るびぃ", "まつもとゆきひろ")
	tbl.AddRow("Erlang", "あーらん", "ジョーアームストロング")
	tbl.AddRow("D言語", "でぃーげんご", "ウォルター・ブライト")

	fmt.Println(tbl.Draw())
}

go-texttable2

About

go-texttable provides creating text table

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages