alexeyco/simpletable
소개
Go로 터미널에 간단한 표를 표시
개발 도구측정된 스타 증가
- in 24h
- +1
- in 7 days
- +1
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSimple tables in terminal with Go
Build readable terminal tables in Go with seven built-in styles, multiline cells, alignment, and column spanning.
Comparison
✅ documented · ⚠️ partial · ❌ not found in sources checked. The last status means the sources checked did not document the feature; it does not establish that the library lacks it. Each symbol links to the public source checked for that comparison.
| Feature | simpletable | termtables | uitable | tablewriter | go-pretty |
|---|---|---|---|---|---|
| Multiline cell content | ✅ | ❌ | ⚠️ | ⚠️ | ❌ |
| Explicit column spans | ✅ | ✅ | ❌ | ⚠️ | ⚠️ |
| Markdown output | ✅ | ✅ | ❌ | ✅ | ✅ |
| Alignment controls | ✅ | ✅ | ⚠️ | ✅ | ✅ |
| Custom table styles | ✅ | ✅ | ❌ | ✅ | ✅ |
Sources checked on 2026-11-09. Add a library as a column or a feature as a row, and link each status to the public source checked.
Quick start
package main
import (
"fmt"
"strings"
"github.com/alexeyco/simpletable"
)
func main() {
table := simpletable.New()
table.Header = &simpletable.Header{
Cells: []*simpletable.Cell{
{Align: simpletable.AlignCenter, Text: "#"},
{Align: simpletable.AlignCenter, Text: "NAME"},
{Align: simpletable.AlignCenter, Text: "TAX"},
},
}
rows := []struct {
name string
tax float64
}{
{"Newton G. Goetz", 532.70},
{"Rebecca R. Edney", 1423.25},
{"John R. Jackson", 7526.12},
{"Ron J. Gomes", 123.84},
{"Penny R. Lewis", 3221.11},
}
total := 0.0
for i, row := range rows {
table.Body.Cells = append(table.Body.Cells, []*simpletable.Cell{
{Align: simpletable.AlignRight, Text: fmt.Sprintf("%d", i+1)},
{Text: row.name},
{Align: simpletable.AlignRight, Text: fmt.Sprintf("$ %.2f", row.tax)},
})
total += row.tax
}
table.Footer = &simpletable.Footer{
Cells: []*simpletable.Cell{
{Align: simpletable.AlignRight, Span: 2, Text: "Subtotal"},
{Align: simpletable.AlignRight, Text: fmt.Sprintf("$ %.2f", total)},
},
}
table.SetStyle(simpletable.StyleCompactLite)
for _, line := range strings.Split(table.String(), "\n") {
fmt.Println(strings.TrimPrefix(strings.TrimRight(line, " "), " "))
}
}
# NAME TAX
--- ------------------ ------------
1 Newton G. Goetz $ 532.70
2 Rebecca R. Edney $ 1423.25
3 John R. Jackson $ 7526.12
4 Ron J. Gomes $ 123.84
5 Penny R. Lewis $ 3221.11
--- ------------------ ------------
Subtotal $ 12827.02
Install with go get github.com/alexeyco/simpletable.
See the styles demo, multiline example, and column-span example for more.
Benchmarks
(MacBook)
Run these benchmarks using the benchmark instructions.
BenchmarkSimpletable-12 33529 35658 ns/op 31001 B/op 551 allocs/op
BenchmarkTermtables-12 34176 34871 ns/op 24255 B/op 755 allocs/op
BenchmarkUITable-12 6642 176902 ns/op 55212 B/op 2830 allocs/op
PASS
ok github.com/alexeyco/simpletable/_example/03-benchmarks-with-others/bench 4.978s
License
관련 프로젝트 살펴보기
불러오는 중…