Skip to content

Releases: jedib0t/go-pretty

v3.3.2

13 Sep 19:26
996191e
Compare
Choose a tag to compare

This patch release fixes a Divide-by-zero error that could happen when rendering multiple trackers. The issue was triggered during ETA calculation of a tracker whose progress was less than 1%.

v3.3.1

03 Sep 07:06
a06b0e8
Compare
Choose a tag to compare

This release includes a minor fix of coloring the borders and separators when they are turned ON while using the provided styles like StyleColoredBright or StyleColoredDark.

v3.3.0

23 Aug 23:27
06e05ef
Compare
Choose a tag to compare

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

19 Aug 16:30
2d30ee9
Compare
Choose a tag to compare

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

16 Aug 06:05
830641e
Compare
Choose a tag to compare

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

14 Aug 18:34
23efe15
Compare
Choose a tag to compare

Changes from v3.0.1:

  • progress: SetMessageWidth to set the max length for all Tracker messages
  • progress: fix race condition when multiple trackers end at the very same time
  • table: SetAllowedColumnLengths should now behave like SetMaxColumnLengths

v3.0.1

10 Aug 16:02
8db8efb
Compare
Choose a tag to compare

Changes from v3.0.0:

  • more documentation; better README.md files
  • table: fix auto-indexed columns for multi-line rows
  • progress: fix rendering issue with PositionLeft

v3.0.0

30 May 18:17
0f07093
Compare
Choose a tag to compare

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

23 May 16:48
b28165e
Compare
Choose a tag to compare

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

22 May 04:16
090b0af
Compare
Choose a tag to compare

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 │                             │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘