Commit graph

13 commits

Author SHA1 Message Date
Mislav Marohnić
734497a8d8
Code fixes informed by golangci-lint failures (#738) 2020-04-03 16:33:34 +02:00
Dasio
9289ab99f2 Use var syntax when empty struct is initialized 2020-02-24 22:33:22 +01:00
Mislav Marohnić
9c2efd6c1c Extract reusable IsTerminal() 2020-02-21 12:46:21 +01:00
Mislav Marohnić
4c3e498021 Fix column alignment and truncation for Eastern Asian languages
- Ensure that text is never truncated mid-character, which would result
  in garbled text

- Ensure that columns in `issue/pr list` output align properly
2020-02-20 18:52:17 +01:00
Mislav Marohnić
61ff5d73bd Fix crash in issue/pr list for narrow terminals
If the available column width is smaller than 3, don't try to truncate
with ellipsis (`...`). Instead, just truncate to available width.
2020-02-18 20:03:09 +01:00
Mislav Marohnić
b6fa88337d Ensure that commands print to a colorable output
If a command does `fmt.Print(...)` for output that contains ANSI color
codes, this not safe on Windows. We have to ensure that we always use
the `fmt.Fprint*` family of functions with a writer that was transformed
using `utils.NewColorable()`.
2019-11-27 20:51:51 +01:00
Mislav Marohnić
4148cf76b9 Merge remote-tracking branch 'origin' into win-ansi-color 2019-11-27 20:08:00 +01:00
Mislav Marohnić
4be04aded3 Fix ANSI color output on Windows 2019-11-27 15:43:28 +01:00
Mislav Marohnić
7d904fdef7 Fix detecting terminal under Git Bash on Windows 2019-11-27 15:31:37 +01:00
Mislav Marohnić
97a6dc494b Redesign TablePrinter to avoid SetContentWidth / FitColumns steps
The API is now:
- AddField;
- EndRow;
- Render.
2019-11-20 13:29:27 +01:00
Mislav Marohnić
2022f8e74b Avoid widening table columns that already fit 2019-11-20 12:30:24 +01:00
Mislav Marohnić
9fc80a1f8a Fix crash with empty table 2019-11-20 12:18:50 +01:00
Mislav Marohnić
f30e973b9d Extract generic row printer that adjusts itself for receiving terminal
This makes the approach from `pr list` reusable across other commands
that may benefit from table-based output, e.g. `issue list` or `pr status`

The idea is: instantiate a printer, connect it to stdout, feed it some
data, and it does the rest: colored, truncated column output that fits
into a terminal, or tab-delimited output (no color, no truncation) for
scripts.
2019-11-15 19:19:41 +01:00