pax_global_header 0000666 0000000 0000000 00000000064 14276450717 0014527 g ustar 00root root 0000000 0000000 52 comment=fce553e800176197145acff5e65cafe07c2cb650
table-1.8.0/ 0000775 0000000 0000000 00000000000 14276450717 0012624 5 ustar 00root root 0000000 0000000 table-1.8.0/.github/ 0000775 0000000 0000000 00000000000 14276450717 0014164 5 ustar 00root root 0000000 0000000 table-1.8.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14276450717 0016221 5 ustar 00root root 0000000 0000000 table-1.8.0/.github/workflows/lint.yml 0000664 0000000 0000000 00000000550 14276450717 0017712 0 ustar 00root root 0000000 0000000 name: golangci-lint
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
args: --timeout 3m --verbose
table-1.8.0/.github/workflows/test.yml 0000664 0000000 0000000 00000001214 14276450717 0017721 0 ustar 00root root 0000000 0000000 name: test
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ] # optionally add macos-latest, windows-latest
name: build and test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.18'
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run test
run: make test table-1.8.0/LICENSE 0000664 0000000 0000000 00000002056 14276450717 0013634 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2022 Aqua Security
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
table-1.8.0/Makefile 0000664 0000000 0000000 00000000160 14276450717 0014261 0 ustar 00root root 0000000 0000000 default: test
.PHONY: test
test:
go test -v -race -cover ./...
.PHONY: readme
readme:
go run ./cmd/examples
table-1.8.0/README.md 0000664 0000000 0000000 00000046642 14276450717 0014117 0 ustar 00root root 0000000 0000000 # table: Tables for terminals
This is a Go module for rendering tables in the terminal.

## Features
- :arrow_up_down: Headers/footers
- :leftwards_arrow_with_hook: Text wrapping
- :twisted_rightwards_arrows: Auto-merging of cells
- :interrobang: Customisable line/border characters
- :rainbow: Customisable line/border colours
- :play_or_pause_button: Individually enable/disable borders, row lines
- :left_right_arrow: Set alignments on a per-column basis, with separate settings for headers/footers
- :triangular_ruler: Intelligently wrap/pad/measure ANSI coloured input
- :dancers: Support for double-width unicode characters
- :bar_chart: Load data from CSV files
Check out the [documentation](https://pkg.go.dev/github.com/aquasecurity/table) for full features/usage.
## Examples
### Example: Basic
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
┌────┬─────────────┬────────┐
│ ID │ Fruit │ Stock │
├────┼─────────────┼────────┤
│ 1 │ Apple │ 14 │
├────┼─────────────┼────────┤
│ 2 │ Banana │ 88,041 │
├────┼─────────────┼────────┤
│ 3 │ Cherry │ 342 │
├────┼─────────────┼────────┤
│ 4 │ Dragonfruit │ 1 │
└────┴─────────────┴────────┘
```
### Example: No Row Lines
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetRowLines(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
┌────┬─────────────┬────────┐
│ ID │ Fruit │ Stock │
├────┼─────────────┼────────┤
│ 1 │ Apple │ 14 │
│ 2 │ Banana │ 88,041 │
│ 3 │ Cherry │ 342 │
│ 4 │ Dragonfruit │ 1 │
└────┴─────────────┴────────┘
```
### Example: No Borders
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetBorders(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
ID │ Fruit │ Stock
────┼─────────────┼────────
1 │ Apple │ 14
────┼─────────────┼────────
2 │ Banana │ 88,041
────┼─────────────┼────────
3 │ Cherry │ 342
────┼─────────────┼────────
4 │ Dragonfruit │ 1
```
### Example: No Borders Or Row Lines
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetRowLines(false)
t.SetBorders(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
ID │ Fruit │ Stock
────┼─────────────┼────────
1 │ Apple │ 14
2 │ Banana │ 88,041
3 │ Cherry │ 342
4 │ Dragonfruit │ 1
```
### Example: Specific Borders
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetRowLines(false)
t.SetBorderLeft(true)
t.SetBorderRight(false)
t.SetBorderTop(true)
t.SetBorderBottom(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
┌────┬─────────────┬────────
│ ID │ Fruit │ Stock
├────┼─────────────┼────────
│ 1 │ Apple │ 14
│ 2 │ Banana │ 88,041
│ 3 │ Cherry │ 342
│ 4 │ Dragonfruit │ 1
```
### Example: Footers
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("ID", "Fruit", "Stock")
t.SetFooters("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
┌────┬─────────────┬────────┐
│ ID │ Fruit │ Stock │
├────┼─────────────┼────────┤
│ 1 │ Apple │ 14 │
├────┼─────────────┼────────┤
│ 2 │ Banana │ 88,041 │
├────┼─────────────┼────────┤
│ 3 │ Cherry │ 342 │
├────┼─────────────┼────────┤
│ 4 │ Dragonfruit │ 1 │
├────┼─────────────┼────────┤
│ ID │ Fruit │ Stock │
└────┴─────────────┴────────┘
```
### Example: Padding
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetPadding(5)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
┌────────────┬─────────────────────┬────────────────┐
│ ID │ Fruit │ Stock │
├────────────┼─────────────────────┼────────────────┤
│ 1 │ Apple │ 14 │
├────────────┼─────────────────────┼────────────────┤
│ 2 │ Banana │ 88,041 │
├────────────┼─────────────────────┼────────────────┤
│ 3 │ Cherry │ 342 │
├────────────┼─────────────────────┼────────────────┤
│ 4 │ Dragonfruit │ 1 │
└────────────┴─────────────────────┴────────────────┘
```
### Example: Alignment
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetAlignment(table.AlignLeft, table.AlignCenter, table.AlignRight)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
┌────┬─────────────┬────────┐
│ ID │ Fruit │ Stock │
├────┼─────────────┼────────┤
│ 1 │ Apple │ 14 │
├────┼─────────────┼────────┤
│ 2 │ Banana │ 88,041 │
├────┼─────────────┼────────┤
│ 3 │ Cherry │ 342 │
├────┼─────────────┼────────┤
│ 4 │ Dragonfruit │ 1 │
└────┴─────────────┴────────┘
```
### Example: Rounded Corners
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetDividers(table.UnicodeRoundedDividers)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
╭────┬─────────────┬────────╮
│ ID │ Fruit │ Stock │
├────┼─────────────┼────────┤
│ 1 │ Apple │ 14 │
├────┼─────────────┼────────┤
│ 2 │ Banana │ 88,041 │
├────┼─────────────┼────────┤
│ 3 │ Cherry │ 342 │
├────┼─────────────┼────────┤
│ 4 │ Dragonfruit │ 1 │
╰────┴─────────────┴────────╯
```
### Example: Custom Dividers
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetDividers(table.Dividers{
ALL: "@",
NES: "@",
NSW: "@",
NEW: "@",
ESW: "@",
NE: "@",
NW: "@",
SW: "@",
ES: "@",
EW: "~",
NS: "!",
})
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
@~~~~@~~~~~~~~~~~~~@~~~~~~~~@
! ID ! Fruit ! Stock !
@~~~~@~~~~~~~~~~~~~@~~~~~~~~@
! 1 ! Apple ! 14 !
@~~~~@~~~~~~~~~~~~~@~~~~~~~~@
! 2 ! Banana ! 88,041 !
@~~~~@~~~~~~~~~~~~~@~~~~~~~~@
! 3 ! Cherry ! 342 !
@~~~~@~~~~~~~~~~~~~@~~~~~~~~@
! 4 ! Dragonfruit ! 1 !
@~~~~@~~~~~~~~~~~~~@~~~~~~~~@
```
### Example: Auto Merge Cells
```go
package main
import (
"os"
"time"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetAutoMerge(true)
t.SetHeaders("System", "Status", "Last Check")
t.AddRow("Life Support", "OK", time.Now().Format(time.Stamp))
t.AddRow("Nuclear Generator", "OK", time.Now().Add(-time.Minute).Format(time.Stamp))
t.AddRow("Weapons Systems", "FAIL", time.Now().Format(time.Stamp))
t.AddRow("Shields", "OK", time.Now().Format(time.Stamp))
t.Render()
}
```
#### Output
```
┌───────────────────┬────────┬─────────────────┐
│ System │ Status │ Last Check │
├───────────────────┼────────┼─────────────────┤
│ Life Support │ OK │ May 13 17:34:32 │
├───────────────────┤ ├─────────────────┤
│ Nuclear Generator │ │ May 13 17:33:32 │
├───────────────────┼────────┼─────────────────┤
│ Weapons Systems │ FAIL │ May 13 17:34:32 │
├───────────────────┼────────┤ │
│ Shields │ OK │ │
└───────────────────┴────────┴─────────────────┘
```
### Example: Load Data From Csv
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
f, err := os.Open("./_examples/12-load-data-from-csv/data.csv")
if err != nil {
panic(err)
}
t := table.New(os.Stdout)
if err := t.LoadCSV(f, true); err != nil {
panic(err)
}
t.Render()
}
```
#### Output
```
┌────┬────────────┬────────────────────────────────────────────┐
│ Id │ Date │ Message │
├────┼────────────┼────────────────────────────────────────────┤
│ 1 │ 2022-05-12 │ Hello world! │
├────┼────────────┼────────────────────────────────────────────┤
│ 2 │ 2022-05-12 │ These messages are loaded from a CSV file. │
├────┼────────────┼────────────────────────────────────────────┤
│ 3 │ 2022-05-13 │ Incredible! │
└────┴────────────┴────────────────────────────────────────────┘
```
### Example: Markdown Format
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetDividers(table.MarkdownDividers)
t.SetBorderTop(false)
t.SetBorderBottom(false)
t.SetRowLines(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
```
#### Output
```
| ID | Fruit | Stock |
|----|-------------|--------|
| 1 | Apple | 14 |
| 2 | Banana | 88,041 |
| 3 | Cherry | 342 |
| 4 | Dragonfruit | 1 |
```
### Example: Header Colspans
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("Namespace", "Resource", "Vulnerabilities", "Misconfigurations")
t.AddHeaders("Namespace", "Resource", "Critical", "High", "Medium", "Low", "Unknown", "Critical", "High", "Medium", "Low", "Unknown")
t.SetHeaderColSpans(0, 1, 1, 5, 5)
t.SetAutoMergeHeaders(true)
t.AddRow("default", "Deployment/app", "2", "5", "7", "8", "0", "0", "3", "5", "19", "0")
t.AddRow("default", "Ingress/test", "-", "-", "-", "-", "-", "1", "0", "2", "17", "0")
t.AddRow("default", "Service/test", "0", "0", "0", "1", "0", "3", "0", "4", "9", "0")
t.Render()
}
```
#### Output
```
┌───────────┬────────────────┬──────────────────────────────────────────┬──────────────────────────────────────────┐
│ Namespace │ Resource │ Vulnerabilities │ Misconfigurations │
│ │ ├──────────┬──────┬────────┬─────┬─────────┼──────────┬──────┬────────┬─────┬─────────┤
│ │ │ Critical │ High │ Medium │ Low │ Unknown │ Critical │ High │ Medium │ Low │ Unknown │
├───────────┼────────────────┼──────────┼──────┼────────┼─────┼─────────┼──────────┼──────┼────────┼─────┼─────────┤
│ default │ Deployment/app │ 2 │ 5 │ 7 │ 8 │ 0 │ 0 │ 3 │ 5 │ 19 │ 0 │
├───────────┼────────────────┼──────────┼──────┼────────┼─────┼─────────┼──────────┼──────┼────────┼─────┼─────────┤
│ default │ Ingress/test │ - │ - │ - │ - │ - │ 1 │ 0 │ 2 │ 17 │ 0 │
├───────────┼────────────────┼──────────┼──────┼────────┼─────┼─────────┼──────────┼──────┼────────┼─────┼─────────┤
│ default │ Service/test │ 0 │ 0 │ 0 │ 1 │ 0 │ 3 │ 0 │ 4 │ 9 │ 0 │
└───────────┴────────────────┴──────────┴──────┴────────┴─────┴─────────┴──────────┴──────┴────────┴─────┴─────────┘
```
## Example: Double-width Unicode
```go
package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("A", "B", "C")
t.AddRow("🔥 unicode 🔥 characters 🔥", "2", "3")
t.AddRow("4", "5", "6")
t.Render()
}
```
#### Output

## Example: ANSI Colours
```go
package main
import (
"os"
"github.com/aquasecurity/table"
"github.com/liamg/tml"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("ID", "Fruit", "Stock", "Description")
t.SetHeaderStyle(table.StyleBold)
t.SetLineStyle(table.StyleBlue)
t.SetDividers(table.UnicodeRoundedDividers)
t.AddRow("1", tml.Sprintf("Apple"), "14", tml.Sprintf("An apple is an edible fruit produced by an apple tree (Malus domestica). "))
t.AddRow("2", tml.Sprintf("Banana"), "88,041", "A banana is an elongated, edible fruit - botanically a berry.")
t.AddRow("3", tml.Sprintf("Cherry"), "342", "A cherry is the fruit of many plants of the genus Prunus, and is a fleshy drupe (stone fruit). ")
t.AddRow("4", tml.Sprintf("Dragonfruit"), "1", "A dragonfruit is the fruit of several different cactus species indigenous to the Americas.")
t.Render()
}
```
#### Output

table-1.8.0/_examples/ 0000775 0000000 0000000 00000000000 14276450717 0014601 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/01-basic/ 0000775 0000000 0000000 00000000000 14276450717 0016100 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/01-basic/main.go 0000664 0000000 0000000 00000000447 14276450717 0017360 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/02-no-row-lines/ 0000775 0000000 0000000 00000000000 14276450717 0017351 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/02-no-row-lines/main.go 0000664 0000000 0000000 00000000475 14276450717 0020632 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetRowLines(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/03-no-borders/ 0000775 0000000 0000000 00000000000 14276450717 0017073 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/03-no-borders/main.go 0000664 0000000 0000000 00000000474 14276450717 0020353 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetBorders(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/04-no-borders-or-row-lines/ 0000775 0000000 0000000 00000000000 14276450717 0021427 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/04-no-borders-or-row-lines/main.go 0000664 0000000 0000000 00000000522 14276450717 0022701 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetRowLines(false)
t.SetBorders(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/05-specific-borders/ 0000775 0000000 0000000 00000000000 14276450717 0020246 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/05-specific-borders/main.go 0000664 0000000 0000000 00000000635 14276450717 0021525 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetRowLines(false)
t.SetBorderLeft(true)
t.SetBorderRight(false)
t.SetBorderTop(true)
t.SetBorderBottom(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/06-footers/ 0000775 0000000 0000000 00000000000 14276450717 0016505 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/06-footers/main.go 0000664 0000000 0000000 00000000515 14276450717 0017761 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("ID", "Fruit", "Stock")
t.SetFooters("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/07-padding/ 0000775 0000000 0000000 00000000000 14276450717 0016433 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/07-padding/main.go 0000664 0000000 0000000 00000000470 14276450717 0017707 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetPadding(5)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/08-alignment/ 0000775 0000000 0000000 00000000000 14276450717 0017004 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/08-alignment/main.go 0000664 0000000 0000000 00000000555 14276450717 0020264 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetAlignment(table.AlignLeft, table.AlignCenter, table.AlignRight)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/09-rounded-corners/ 0000775 0000000 0000000 00000000000 14276450717 0020140 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/09-rounded-corners/main.go 0000664 0000000 0000000 00000000524 14276450717 0021414 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetDividers(table.UnicodeRoundedDividers)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/10-custom-dividers/ 0000775 0000000 0000000 00000000000 14276450717 0020140 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/10-custom-dividers/main.go 0000664 0000000 0000000 00000000716 14276450717 0021417 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetDividers(table.Dividers{
ALL: "@",
NES: "@",
NSW: "@",
NEW: "@",
ESW: "@",
NE: "@",
NW: "@",
SW: "@",
ES: "@",
EW: "~",
NS: "!",
})
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/11-auto-merge-cells/ 0000775 0000000 0000000 00000000000 14276450717 0020165 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/11-auto-merge-cells/main.go 0000664 0000000 0000000 00000000737 14276450717 0021447 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"time"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetAutoMerge(true)
t.SetHeaders("System", "Status", "Last Check")
t.AddRow("Life Support", "OK", time.Now().Format(time.Stamp))
t.AddRow("Nuclear Generator", "OK", time.Now().Add(-time.Minute).Format(time.Stamp))
t.AddRow("Weapons Systems", "FAIL", time.Now().Format(time.Stamp))
t.AddRow("Shields", "OK", time.Now().Format(time.Stamp))
t.Render()
}
table-1.8.0/_examples/12-load-data-from-csv/ 0000775 0000000 0000000 00000000000 14276450717 0020401 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/12-load-data-from-csv/data.csv 0000664 0000000 0000000 00000000200 14276450717 0022017 0 ustar 00root root 0000000 0000000 Id,Date,Message
1,2022-05-12,"Hello world!"
2,2022-05-12,"These messages are loaded from a CSV file."
3,2022-05-13,"Incredible!" table-1.8.0/_examples/12-load-data-from-csv/main.go 0000664 0000000 0000000 00000000431 14276450717 0021652 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
f, err := os.Open("./_examples/12-load-data-from-csv/data.csv")
if err != nil {
panic(err)
}
t := table.New(os.Stdout)
if err := t.LoadCSV(f, true); err != nil {
panic(err)
}
t.Render()
}
table-1.8.0/_examples/13-markdown-format/ 0000775 0000000 0000000 00000000000 14276450717 0020132 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/13-markdown-format/main.go 0000664 0000000 0000000 00000000625 14276450717 0021410 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetDividers(table.MarkdownDividers)
t.SetBorderTop(false)
t.SetBorderBottom(false)
t.SetRowLines(false)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "Apple", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/14-header-colspans/ 0000775 0000000 0000000 00000000000 14276450717 0020073 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/14-header-colspans/main.go 0000664 0000000 0000000 00000001231 14276450717 0021343 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("Namespace", "Resource", "Vulnerabilities", "Misconfigurations")
t.AddHeaders("Namespace", "Resource", "Critical", "High", "Medium", "Low", "Unknown", "Critical", "High", "Medium", "Low", "Unknown")
t.SetHeaderColSpans(0, 1, 1, 5, 5)
t.SetAutoMergeHeaders(true)
t.AddRow("default", "Deployment/app", "2", "5", "7", "8", "0", "0", "3", "5", "19", "0")
t.AddRow("default", "Ingress/test", "-", "-", "-", "-", "-", "1", "0", "2", "17", "0")
t.AddRow("default", "Service/test", "0", "0", "0", "1", "0", "3", "0", "4", "9", "0")
t.Render()
}
table-1.8.0/_examples/15-only-wrap-when-needed/ 0000775 0000000 0000000 00000000000 14276450717 0021135 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/15-only-wrap-when-needed/main.go 0000664 0000000 0000000 00000000562 14276450717 0022413 0 ustar 00root root 0000000 0000000 package main
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("ID", "Fruit", "Stock")
t.AddRow("1", "01234567890123456789012345678901234567890123456789012345678901234567890123456789", "14")
t.AddRow("2", "Banana", "88,041")
t.AddRow("3", "Cherry", "342")
t.AddRow("4", "Dragonfruit", "1")
t.Render()
}
table-1.8.0/_examples/95-double-width-unicode/ 0000775 0000000 0000000 00000000000 14276450717 0021047 5 ustar 00root root 0000000 0000000 table-1.8.0/_examples/95-double-width-unicode/main.go 0000664 0000000 0000000 00000000365 14276450717 0022326 0 ustar 00root root 0000000 0000000 package main
// noreadme
import (
"os"
"github.com/aquasecurity/table"
)
func main() {
t := table.New(os.Stdout)
t.SetHeaders("A", "B", "C")
t.AddRow("🔥 unicode 🔥 characters 🔥", "2", "3")
t.AddRow("4", "5", "6")
t.Render()
}
table-1.8.0/_examples/95-double-width-unicode/screenshot.png 0000664 0000000 0000000 00000013757 14276450717 0023747 0 ustar 00root root 0000000 0000000 PNG
IHDR R`j; pHYs + IDATxy\gL@,p%l UYԵVD={Zֽj{mmE,uU) P?I5YG}Hf}/$!!\ B&XdtU?Bӌ7Xwr.y]m|#-`!h!DF!Z0BB0Ba#-`!h!DF!Z}tر
6n\]] 'ٰq]hhUտ{no-˝̙5d?}(GFƶwvv uOd]gz$tRR¦W72XsfϞ=jxd;nI=;QSs#_o?|YJĈ"6glyKeeGFAI/aC]# @(vtCS$ɮݦ$b= F謭JT!PȨ-7jjjU3*(^_qrdHW9DSR'/L[P^~ҡ-2455ٱ&3zxyy:~[ݒe˖
v9Ɉ?vww,G%N;0zDEE, ""{ڵke0lΎ
עJ .cǚFȨ x^ebB&JO<Fz}`@;0~Ŝ))#$AFsʕXG7Tq2!qAA٥ |i^T_Aapu/hnnqtC'N(j|Dwww}/L2 ^{+W LVWW^!g0 u&3`@#c|ތhmGwQXXT*!-_j(atR{O7aa#rАKz\^SS'J˜NK5cǎ3u0{۷}FYT;o\znn^nn]J9#-`!h!DF!Z0BB0Ba#-`!h!DF!Z0Bl?Ӆ]A=O3"!ڟǠ5Ɨi!Z0BB0Ba#-`!h!D`1P/8v^nz==kZzHn#9h[[y`'` t\[6Imd; nG`l݅0bML;ڡ8t$CCCxb˵Wð;cO`uQ28*o7͓N}Xz]b5|3kfCɤy%I^Z