tables

Simple representation of tables on console
Examples
Basic example
import "github.com/saromanov/tables"
func main() {
t := tables.New()
t.AddHeader("foo", "bar")
t.AddLine("a", "b")
t.AddLine("c", "d")
t.Build()
}
Output:
foo bar
--- ---
a b
c d
Hooks
You can add hook before execution of the table. As example it might be colorized of the table
import (
"github.com/fatih/color"
"github.com/saromanov/tables"
)
table := tables.New()
table.AddHooks(func(s string) string {
return color.New(color.FgGreen).SprintFunc()(s)
},
)
table.AddHeader("one", "two", "three", "four")
table.AddHooks(func(s string) string {
return color.New(color.FgYellow).SprintFunc()(s)
},
)
table.AddLine("red", "poom", "boom", "sasdsadasdas")
table.AddLine("red", "poom", "boom", "sasdsadasdas")
table.Build()
```