Skip to content

Releases: jedib0t/go-pretty

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

v2.3.0

20 May 23:45
844e6f1
Compare
Choose a tag to compare

Track the Progress of one or more Tasks (like downloading multiple files in parallel).

  • Track one or more Tasks at the same time
  • Dynamically add one or more Task Trackers while Render() is in progress
  • Choose to have the Writer auto-stop the Render when no more Trackers are
    in queue, or manually stop using Stop()
  • Redirect output to an io.Writer object (like os.StdOut)
  • Completely customizable styles
    • Many ready-to-use styles: style.go
    • Colorize various parts of the Tracker using StyleColors
    • Customize how Trackers get rendered using StyleOptions

Sample Progress Tracking:

Calculating Total   #  1 ... done! [3.25K in 100ms]
Calculating Total   #  2 ... done! [6.50K in 100ms]
Downloading File    #  3 ... done! [9.75KB in 100ms]
Transferring Amount #  4 ... done! [$26.00K in 200ms]
Transferring Amount #  5 ... done! [£32.50K in 201ms]
Downloading File    #  6 ... done! [58.50KB in 300ms]
Calculating Total   #  7 ... done! [91.00K in 400ms]
Transferring Amount #  8 ... 60.9% (●●●●●●●●●●●●●●◌◌◌◌◌◌◌◌◌) [$78.00K in 399.071ms]
Downloading File    #  9 ... 32.1% (●●●●●●●○◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌) [58.50KB in 298.947ms]
Transferring Amount # 10 ... 13.0% (●●○◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌◌) [£32.50K in 198.84ms]

Real-time playback of the demo @ asciinema.org:
asciicast

v2.2.0

15 May 06:08
4c495c9
Compare
Choose a tag to compare

This minor release includes a lot more Colored styles for Table.

Run go run cmd/demo-table/demo.go colors to check it out:

demo-colors