🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

github.com/saromanov/tables

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/saromanov/tables

v0.0.0-20200118183819-b496322efb51
Source
Go
Version published
Created
Source

tables

Go Report Card Build Status Codacy Badge Coverage Status

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()
	```

FAQs

Package last updated on 18 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts