Skip to content

Commit

Permalink
README Update
Browse files Browse the repository at this point in the history
  • Loading branch information
cheynewallace committed Dec 23, 2020
1 parent 2dbc50a commit ec0b5a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.log
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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"
```
Expand All @@ -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")
Expand All @@ -31,13 +35,15 @@ t.Print()
```

**Output**

```
NAME TITLE DEPARTMENT
---- ----- ----------
John Smith Developer Engineering
```

## Example Without Heading

```go
t := tabby.New()
t.AddLine("Info:", "WEB", "Success 200")
Expand All @@ -47,20 +53,24 @@ t.Print()
```

**Output**

```
Info: WEB Success 200
Info: API Success 201
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

Expand All @@ -75,13 +85,14 @@ func main() {
```

- File writer example:

```go
package main

import (
"os"
"text/tabwriter"

"github.com/cheynewallace/tabby"
)

Expand Down

0 comments on commit ec0b5a0

Please sign in to comment.