Skip to content

Commit 33047f3

Browse files
committed
update readme
1 parent 66e06ee commit 33047f3

File tree

1 file changed

+31
-55
lines changed

1 file changed

+31
-55
lines changed

README.md

Lines changed: 31 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ go get github.com/olekukonko/[email protected]
2828
#### Latest Version
2929
The latest stable version
3030
```bash
31-
go get github.com/olekukonko/[email protected].6
31+
go get github.com/olekukonko/[email protected].7
3232
```
3333

3434
**Warning:** Version `v1.0.0` contains missing functionality and should not be used.
3535

3636

3737
> **Version Guidance**
38-
> - Production: Use `v0.0.5` (stable)
38+
> - Legacy: Use `v0.0.5` (stable)
3939
> - New Features: Use `@latest` (includes generics, super fast streaming APIs)
4040
> - Legacy Docs: See [README_LEGACY.md](README_LEGACY.md)
4141
@@ -62,7 +62,7 @@ func main() {
6262
data := [][]string{
6363
{"Package", "Version", "Status"},
6464
{"tablewriter", "v0.0.5", "legacy"},
65-
{"tablewriter", "v1.0.6", "latest"},
65+
{"tablewriter", "v1.0.7", "latest"},
6666
}
6767

6868
table := tablewriter.NewWriter(os.Stdout)
@@ -77,7 +77,7 @@ func main() {
7777
│ PACKAGE │ VERSION │ STATUS │
7878
├─────────────┼─────────┼────────┤
7979
│ tablewriter │ v0.0.5 │ legacy │
80-
│ tablewriter │ v1.0.6 │ latest │
80+
│ tablewriter │ v1.0.7 │ latest │
8181
└─────────────┴─────────┴────────┘
8282
```
8383

@@ -297,7 +297,7 @@ func main() {
297297
}
298298

299299
table.Configure(func(config *tablewriter.Config) {
300-
config.Row.Formatting.Alignment = tw.AlignLeft
300+
config.Row.Alignment.Global = tw.AlignLeft
301301
})
302302
table.Render()
303303
}
@@ -368,14 +368,12 @@ func main() {
368368
tablewriter.WithRenderer(renderer.NewColorized(colorCfg)),
369369
tablewriter.WithConfig(tablewriter.Config{
370370
Row: tw.CellConfig{
371-
Formatting: tw.CellFormatting{
372-
AutoWrap: tw.WrapNormal, // Wrap long content
373-
Alignment: tw.AlignLeft, // Left-align rows
374-
},
371+
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNormal}, // Wrap long content
372+
Alignment: tw.CellAlignment{Global: tw.AlignLeft}, // Left-align rows
375373
ColMaxWidths: tw.CellWidth{Global: 25},
376374
},
377375
Footer: tw.CellConfig{
378-
Formatting: tw.CellFormatting{Alignment: tw.AlignRight},
376+
Alignment: tw.CellAlignment{Global: tw.AlignRight},
379377
},
380378
}),
381379
)
@@ -480,19 +478,13 @@ func main() {
480478

481479
table := tablewriter.NewTable(os.Stdout,
482480
tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
483-
Settings: tw.Settings{
484-
Separators: tw.Separators{BetweenRows: tw.On},
485-
},
481+
Settings: tw.Settings{Separators: tw.Separators{BetweenRows: tw.On}},
486482
})),
487483
tablewriter.WithConfig(tablewriter.Config{
488-
Header: tw.CellConfig{
489-
Formatting: tw.CellFormatting{Alignment: tw.AlignCenter},
490-
},
484+
Header: tw.CellConfig{Alignment: tw.CellAlignment{Global: tw.AlignCenter}},
491485
Row: tw.CellConfig{
492-
Formatting: tw.CellFormatting{
493-
MergeMode: tw.MergeHierarchical,
494-
Alignment: tw.AlignLeft,
495-
},
486+
Formatting: tw.CellFormatting{MergeMode: tw.MergeHierarchical},
487+
Alignment: tw.CellAlignment{Global: tw.AlignLeft},
496488
},
497489
}),
498490
)
@@ -546,21 +538,20 @@ func main() {
546538

547539
table := tablewriter.NewTable(os.Stdout,
548540
tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
549-
Settings: tw.Settings{
550-
Separators: tw.Separators{BetweenRows: tw.On},
551-
},
541+
Settings: tw.Settings{Separators: tw.Separators{BetweenRows: tw.On}},
552542
})),
553543
tablewriter.WithConfig(tablewriter.Config{
554544
Row: tw.CellConfig{
555-
Formatting: tw.CellFormatting{MergeMode: tw.MergeBoth},
556-
ColumnAligns: []tw.Align{tw.Skip, tw.Skip, tw.AlignRight, tw.AlignLeft},
545+
Formatting: tw.CellFormatting{MergeMode: tw.MergeBoth},
546+
Alignment: tw.CellAlignment{PerColumn: []tw.Align{tw.Skip, tw.Skip, tw.AlignRight, tw.AlignLeft}},
557547
},
548+
558549
Footer: tw.CellConfig{
559550
Padding: tw.CellPadding{
560551
Global: tw.Padding{Left: "*", Right: "*"},
561552
PerColumn: []tw.Padding{{}, {}, {Bottom: "^"}, {Bottom: "^"}},
562553
},
563-
ColumnAligns: []tw.Align{tw.Skip, tw.Skip, tw.AlignRight, tw.AlignLeft},
554+
Alignment: tw.CellAlignment{PerColumn: []tw.Align{tw.Skip, tw.Skip, tw.AlignRight, tw.AlignLeft}},
564555
},
565556
}),
566557
)
@@ -617,9 +608,7 @@ func main() {
617608
})),
618609
tablewriter.WithConfig(tablewriter.Config{
619610
MaxWidth: 10,
620-
Row: tw.CellConfig{
621-
Formatting: tw.CellFormatting{Alignment: tw.AlignCenter},
622-
},
611+
Row: tw.CellConfig{Alignment: tw.CellAlignment{Global: tw.AlignCenter}},
623612
}),
624613
)
625614
table.Append([]string{s, s})
@@ -631,16 +620,12 @@ func main() {
631620
// Main table
632621
table := tablewriter.NewTable(os.Stdout,
633622
tablewriter.WithRenderer(renderer.NewBlueprint(tw.Rendition{
634-
Borders: tw.BorderNone,
635-
Settings: tw.Settings{
636-
Separators: tw.Separators{BetweenColumns: tw.On},
637-
},
623+
Borders: tw.BorderNone,
624+
Settings: tw.Settings{Separators: tw.Separators{BetweenColumns: tw.On}},
638625
})),
639626
tablewriter.WithConfig(tablewriter.Config{
640627
MaxWidth: 30,
641-
Row: tw.CellConfig{
642-
Formatting: tw.CellFormatting{Alignment: tw.AlignCenter},
643-
},
628+
Row: tw.CellConfig{Alignment: tw.CellAlignment{Global: tw.AlignCenter}},
644629
}),
645630
)
646631
table.Append([]string{createSubTable("A"), createSubTable("B")})
@@ -711,14 +696,11 @@ func main() {
711696
tablewriter.WithStringer(employeeStringer),
712697
tablewriter.WithConfig(tablewriter.Config{
713698
Header: tw.CellConfig{
714-
Formatting: tw.CellFormatting{Alignment: tw.AlignCenter, AutoFormat: tw.On},
715-
},
716-
Row: tw.CellConfig{
717-
Formatting: tw.CellFormatting{Alignment: tw.AlignLeft},
718-
},
719-
Footer: tw.CellConfig{
720-
Formatting: tw.CellFormatting{Alignment: tw.AlignRight},
699+
Formatting: tw.CellFormatting{AutoFormat: tw.On},
700+
Alignment: tw.CellAlignment{Global: tw.AlignCenter},
721701
},
702+
Row: tw.CellConfig{Alignment: tw.CellAlignment{Global: tw.AlignLeft}},
703+
Footer: tw.CellConfig{Alignment: tw.CellAlignment{Global: tw.AlignRight}},
722704
}),
723705
)
724706
table.Header([]string{"ID", "Name", "Age", "Department", "Salary"})
@@ -784,23 +766,17 @@ func main() {
784766
}
785767

786768
table := tablewriter.NewTable(os.Stdout,
787-
tablewriter.WithRenderer(renderer.NewHTML(os.Stdout, false, htmlCfg)),
769+
tablewriter.WithRenderer(renderer.NewHTML(htmlCfg)),
788770
tablewriter.WithConfig(tablewriter.Config{
789771
Header: tw.CellConfig{
790-
Formatting: tw.CellFormatting{
791-
Alignment: tw.AlignCenter,
792-
MergeMode: tw.MergeHorizontal, // Merge identical header cells
793-
},
772+
Formatting: tw.CellFormatting{MergeMode: tw.MergeHorizontal}, // Merge identical header cells
773+
Alignment: tw.CellAlignment{Global: tw.AlignCenter},
794774
},
795775
Row: tw.CellConfig{
796-
Formatting: tw.CellFormatting{
797-
MergeMode: tw.MergeHorizontal, // Merge identical row cells
798-
Alignment: tw.AlignLeft,
799-
},
800-
},
801-
Footer: tw.CellConfig{
802-
Formatting: tw.CellFormatting{Alignment: tw.AlignRight},
776+
Formatting: tw.CellFormatting{MergeMode: tw.MergeHorizontal}, // Merge identical row cells
777+
Alignment: tw.CellAlignment{Global: tw.AlignLeft},
803778
},
779+
Footer: tw.CellConfig{Alignment: tw.CellAlignment{Global: tw.AlignRight}},
804780
}),
805781
)
806782

0 commit comments

Comments
 (0)