https://github.com/anilmisirlioglu/table-parser
Easily parse your cool table-style output data
https://github.com/anilmisirlioglu/table-parser
cli-table-parser k8s-cli-table-parser table-parser
Last synced: 6 months ago
JSON representation
Easily parse your cool table-style output data
- Host: GitHub
- URL: https://github.com/anilmisirlioglu/table-parser
- Owner: anilmisirlioglu
- License: mit
- Created: 2023-02-23T12:48:54.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-24T22:36:26.000Z (almost 3 years ago)
- Last Synced: 2025-02-12T05:57:04.927Z (10 months ago)
- Topics: cli-table-parser, k8s-cli-table-parser, table-parser
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Table Parser [](http://golang.org)
Easily parse your cool table-style output data.
## Example
```go
package main
import (
"fmt"
"strings"
"github.com/anilmisirlioglu/table-parser"
)
const input = `
REPOSITORY TAG IMAGE ID CREATED SIZE
foo latest cf508acd919c 26 hours ago 24.5MB
bar latest 382715ecff56 2 months ago 705MB
baz v2.3.5 cc88abbad18b 2 months ago 317MB
`
func main() {
// Read the all table
t := table.ReadAll(input)
fmt.Printf("table header len: %d\n", len(t.Header.Cells))
// With using Reader
r := table.NewReader(strings.NewReader(input))
fmt.Printf("table header len: %d\n", len(r.Header().Cells))
for r.Next() {
fmt.Printf("Row: %+v\n", r.Row())
}
}
```
## Roadmap
- [ ] Table Writer
- [ ] Optimize the Header parser algorithm