Categorygithub.com/404tk/table
modulepackage
0.0.4
Repository: https://github.com/404tk/table.git
Documentation: pkg.go.dev

# README

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     |
+-----------+----------+------------------+

# Functions

No description provided by the author
Output formats slice of structs data and writes to standard output.
Table formats slice of structs data and returns the resulting string.