All Projects → crackcomm → Go Clitable

crackcomm / Go Clitable

Command line (ASCII) and Markdown table for Golang. You probably want to take a look at: https://github.com/olekukonko/tablewriter

Programming Languages

go
31211 projects - #10 most used programming language

go-clitable

Deprecated in favor of olekukonko/tablewriter

GoDoc

ASCII and Markdown tables in console for golang.

Usage

Print table

table := New([]string{"Name", "Host", "..."})
table.AddRow(map[string]interface{}{"Name": "..."})
table.Print()
|----------------------------------------------------------------------------------------|
| Name              | Host                 | Type             | _id                      |
|----------------------------------------------------------------------------------------|
| MongoLab          | mongolab.com         | MongoDB Provider | 52518c5d56357d17ec000002 |
|----------------------------------------------------------------------------------------|
| Google App Engine | appengine.google.com | App Engine       | 52518ff356357d17ec000004 |
|----------------------------------------------------------------------------------------|
| Heroku            | heroku.com           | App Engine       | 5251918e56357d17ec000005 |
|----------------------------------------------------------------------------------------|

Horizontal table

table.PrintHorizontal(map[string]interface{}{
	"Name": "MongoLab",
	"Host": "mongolab.com",
})
|---------------------------------|
| Name | MongoLab                 |
|---------------------------------|
| Host | mongolab.com             |
|---------------------------------|
| Type | MongoDB Provider         |
|---------------------------------|
| _id  | 52518c5d56357d17ec000002 |
|---------------------------------|

Markdown table

table := New([]string{"Name", "Host", "..."})
table.AddRow(map[string]interface{}{"Name": "..."})
table.Markdown = true
table.Print()
| Name              | Host                 | Type             | _id                      |
| ----------------- | -------------------- | ---------------- | ------------------------ |
| MongoLab          | mongolab.com         | MongoDB Provider | 52518c5d56357d17ec000002 |
| Google App Engine | appengine.google.com | App Engine       | 52518ff356357d17ec000004 |
| Heroku            | heroku.com           | App Engine       | 5251918e56357d17ec000005 |
Name Host Type _id
MongoLab mongolab.com MongoDB Provider 52518c5d56357d17ec000002
Google App Engine appengine.google.com App Engine 52518ff356357d17ec000004
Heroku heroku.com App Engine 5251918e56357d17ec000005

License

Unlicensed. For more information, please refer to http://unlicense.org.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].