From ec0b5a051c862244d3ad8b955de396f4f1bc4113 Mon Sep 17 00:00:00 2001 From: Cheyne Wallace Date: Wed, 23 Dec 2020 12:19:22 +1100 Subject: [PATCH] README Update --- .gitignore | 1 + README.md | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..397b4a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.log diff --git a/README.md b/README.md index 14c73ff..5bf89a0 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ -[![cover.run](https://cover.run/go/github.com/cheynewallace/tabby.svg?style=flat&tag=golang-1.10)](https://cover.run/go?tag=golang-1.10&repo=github.com%2Fcheynewallace%2Ftabby) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) # Tabby + A tiny library for super simple Golang tables **Get Tabby** + ```go go get github.com/cheynewallace/tabby ``` **Import Tabby** + ```go import "github.com/cheynewallace/tabby" ``` @@ -19,10 +21,12 @@ Tabby is a tiny (around 70 lines of code) efficient libary for writing extremely Many table libraries out there are overly complicated and packed with features you don't need. If you simply want to write clean output to your terminal in table format with minimal effort, Tabby is for you. Typical examples -* Writing simple tables with heading and tab spaced columns -* Writing log lines to the terminal with evenly spaced columns + +- Writing simple tables with heading and tab spaced columns +- Writing log lines to the terminal with evenly spaced columns ## Example With Heading + ```go t := tabby.New() t.AddHeader("NAME", "TITLE", "DEPARTMENT") @@ -31,6 +35,7 @@ t.Print() ``` **Output** + ``` NAME TITLE DEPARTMENT ---- ----- ---------- @@ -38,6 +43,7 @@ John Smith Developer Engineering ``` ## Example Without Heading + ```go t := tabby.New() t.AddLine("Info:", "WEB", "Success 200") @@ -47,6 +53,7 @@ t.Print() ``` **Output** + ``` Info: WEB Success 200 Info: API Success 201 @@ -54,13 +61,16 @@ Error: DATABASE Connection Established ``` ## Example With Custom tabWriter + ```go w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) t := tabby.NewCustom(w) ``` ## Full Example + - Default writer (os.Stdout) example: + ```go package main @@ -75,13 +85,14 @@ func main() { ``` - File writer example: + ```go package main import ( "os" "text/tabwriter" - + "github.com/cheynewallace/tabby" )