Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Vegasq/GoPrintTable

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GoPrintTable

Install

For stable release:

go get gopkg.in/vegasq/GoPrintTable.v1

import "gopkg.in/vegasq/GoPrintTable.v1"

For devel release:

go get github.com/vegasq/GoPrintTable

import "github.com/vegasq/GoPrintTable"

Usage

Let's assume we have such structure:

header := []string{"Node Name", "IP", "Status"}
node1 := []string{"controller", "192.168.0.100", "Online"}
node2 := []string{"minion1", "192.168.0.101", "Offline"}
node3 := []string{"minion2", "192.168.0.102"}
t := [][]string{header, node1, node2, node3}

Now let's print it to console with:

GoPrintTable.PrintTableWithHeader(t)

Output will be:

----------------------------------------
| Node Name  | IP            | Status  |
----------------------------------------
| controller | 192.168.0.100 | Online  |
| minion1    | 192.168.0.101 | Offline |
| minion2    | 192.168.0.102 | -       |
----------------------------------------

Or with:

GoPrintTable.PrintTable(t)

Output will be:

----------------------------------------
| Node Name  | IP            | Status  |
| controller | 192.168.0.100 | Online  |
| minion1    | 192.168.0.101 | Offline |
| minion2    | 192.168.0.102 | -       |
----------------------------------------

About

GoLang lib to print [][]string as nice formatted table.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.