Skip to content
/ table Public
forked from modood/table

Modified from github.com/modood/table

License

Notifications You must be signed in to change notification settings

404tk/table

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

table

Modified from github.com/modood/table.

Installation

$ go get github.com/404tk/table

Quick start

package main

import (
	"github.com/404tk/table"
)

type House struct {
	Name  string `table:"Name"`
	Sigil string
	Motto string
}

func main() {
	hs := []House{
		{"Stark", "direwolf", "Winter is coming"},
		{"Targaryen", "dragon", "Fire and Blood"},
		{"Lannister", "lion", "Hear Me Roar"},
	}

	// Output to stdout
	table.Output(hs)

	// Or just return table string and then do something
	s := table.Table(hs)
	_ = s
}

output:

+-----------+----------+------------------+
|   NAME    |  SIGIL   |      MOTTO       |
+-----------+----------+------------------+
| Stark     | direwolf | Winter is coming |
| Targaryen | dragon   | Fire and Blood   |
| Lannister | lion     | Hear Me Roar     |
+-----------+----------+------------------+

About

Modified from github.com/modood/table

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 96.3%
  • Makefile 3.7%