Releases: jedib0t/go-pretty
v3.3.2
v3.3.1
v3.3.0
This release includes support in progress
for rendering an "Overall" Tracker to track the progress of the entire operation (not just a single task). It also includes a bunch of bug-fixes:
- progress: support "Overall" tracker to track the entire progress with an approx. ETA
- progress: fix tracker string generation for fractional progress
- text: fix RepeatAndTrim() for strings with Unicode chars; fixes #58
- text: fix WrapText() to work with escape sequences; fixes #59
- text: color: fix race condition while generating escape sequences
v3.2.0
This minor release has code to detect if the console/terminal supports ANSI escape codes/sequences. On Windows, it will try to enable support (Win 10 supports it with a toggle), and if that doesn't work, it falls back to no-color mode. On other systems, the code assumes that ANSI escape codes are supported.
This release also deprecates /util
and moves all the functionality into appropriate places in /table
and /text
.
v3.1.1
This patch release includes a bug-fix to the way the progress tracker bar was being rendered. There were corner cases where the bar would include an additional "dot" going over the expected/set progress bar length. This release includes a fix for such a case.
v3.1.0
v3.0.1
v3.0.0
Changes from v2.0.0:
- Remove external dependencies as much as possible (
v2.1.0
) - Table: more colorful styles in
table/style.go
(v2.2.0
) - Progress/Task Tracker
progress/writer.go
(v2.3.0
) - Table: sort rows by any column (
v2.4.0
) - Table: page rows every X number of rows (
v2.5.0
) - List: refactor and simplify styles in
list/style.go
v2.5.0
You can limit then number of lines rendered in a single "Page". This logic
can handle rows with multiple lines too. Here is a simple example:
t.SetPageSize(1)
t.Render()
to get:
+-----+------------+-----------+--------+-----------------------------+
| # | FIRST NAME | LAST NAME | SALARY | |
+-----+------------+-----------+--------+-----------------------------+
| 1 | Arya | Stark | 3000 | |
+-----+------------+-----------+--------+-----------------------------+
| | | TOTAL | 10000 | |
+-----+------------+-----------+--------+-----------------------------+
+-----+------------+-----------+--------+-----------------------------+
| # | FIRST NAME | LAST NAME | SALARY | |
+-----+------------+-----------+--------+-----------------------------+
| 20 | Jon | Snow | 2000 | You know nothing, Jon Snow! |
+-----+------------+-----------+--------+-----------------------------+
| | | TOTAL | 10000 | |
+-----+------------+-----------+--------+-----------------------------+
+-----+------------+-----------+--------+-----------------------------+
| # | FIRST NAME | LAST NAME | SALARY | |
+-----+------------+-----------+--------+-----------------------------+
| 300 | Tyrion | Lannister | 5000 | |
+-----+------------+-----------+--------+-----------------------------+
| | | TOTAL | 10000 | |
+-----+------------+-----------+--------+-----------------------------+
v2.4.0
Support sorting tables by any of the columns. The sorting directives can be specified using the Column Name (needs a header row with the Column Names) or the Column Number (1-indexed).
Example:
tw := table.NewWriter()
tw.AppendHeader(table.Row{"#", "First Name", "Last Name", "Salary"})
tw.AppendRows([]table.Row{
{1, "Arya", "Stark", 3000},
{11, "Sansa", "Stark", 6000},
{20, "Jon", "Snow", 2000, "You know nothing, Jon Snow!"},
{300, "Tyrion", "Lannister", 5000},
})
tw.SetStyle(table.StyleLight)
tw.SortBy([]table.SortBy{
{Name: "Last Name", Mode: table.Asc},
{Name: "First Name", Mode: table.Dsc},
{Number: 4, Mode: table.DscNumeric}, // corresponds to the "Salary" column
})
fmt.Println(tw.Render())
results in:
┌─────┬────────────┬───────────┬────────┬─────────────────────────────┐
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 300 │ Tyrion │ Lannister │ 5000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 11 │ Sansa │ Stark │ 6000 │ │
│ 1 │ Arya │ Stark │ 3000 │ │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘