Skip to content

Commit

Permalink
update documentation (table sorting, go mod and v6.0.0++)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedib0t committed Apr 6, 2021
1 parent 76ffd6c commit ad9b9ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
21 changes: 5 additions & 16 deletions README.md
Expand Up @@ -101,22 +101,11 @@ BenchmarkTable_RenderHTML-2 88633 13425 ns/op 4080 B/op
BenchmarkTable_RenderMarkdown-2 107420 10991 ns/op 2560 B/op 44 allocs/op
```

## A note about v6.0.0 and above ...

To make `go-pretty` completely compatible with `go mod`, versions `v6.0.0` and
above will include changes that are known to break `dep` support. As far as I
can tell, `dep` is looking for funding right now and is not being actively
developed or maintained and has an interoperability issue with how `go mod`
deals with package versioning.

If you want to continue to use `dep`, versions `v5.1.x` and below should
continue to work. If `dep` maintainers can merge the code proposed in
[PR#1963](https://github.com/golang/dep/pull/1963), it should make `v6.0.0` and
above usable too. Given that the PR has not been merged since July 2018, I am
not too hopeful. :disappointed:

To use `v6.0.0` (or newer version) of this library, you'd have to modify the
import paths from something like:
## v6.0.0++

If you are using a version of this library older than `v6.0.0` and want to move
to a newer version of this library, you'd have to modify the import paths from
something like:
```golang
"github.com/jedib0t/go-pretty/list"
"github.com/jedib0t/go-pretty/progress"
Expand Down
12 changes: 12 additions & 0 deletions table/README.md
Expand Up @@ -284,6 +284,18 @@ to get:
+-----+------------+-----------+--------+-----------------------------+
```

## Sorting

Sorting can be done on one or more columns. The following code will make the
rows be sorted first by "First Name" and then by "Last Name" (in case of similar
"First Name" entries).
```golang
t.SortBy([]table.SortBy{
{Name: "First Name", Mode: table.Asc},
{Name: "Last Name", Mode: table.Asc},
})
```

## Wrapping (or) Row/Column Width restrictions

You can restrict the maximum (text) width for a Row:
Expand Down

0 comments on commit ad9b9ed

Please sign in to comment.