Commit graph

52 commits

Author SHA1 Message Date
vilmibm
f4b8851011 Merge remote-tracking branch 'origin/master' into pr-status-no-commits 2020-03-25 12:00:58 -05:00
vilmibm
5187ad4431 move preparecmd and Runnable to its own package 2020-03-23 16:32:29 -05:00
Mislav Marohnić
488b47bded Enable tests to capture spinner output
Explicitly assign the writer stream for the progress spinner so that
tests may override it.

The default when not in testing stays the same: the output stream is the
colorable stdout.
2020-03-20 18:18:27 +01:00
vilmibm
0344e9543a humanize branch name for title 2020-03-17 16:18:32 -05:00
Christian Muehlhaeuser
0d6e347155
Bump glamour dependency
This indirectly also updates the chroma syntax highlighting package,
which fixes a rendering bug for CRLF line endings, which we
encountered in cli. We can therefore remove our internal work-around.
2020-03-04 15:03:04 +01:00
Nate Smith
3d7733870e
Merge branch 'master' into repo-fork 2020-03-03 15:40:54 -06:00
vilmibm
1217bfce09 add spinner helper 2020-02-26 11:41:54 -06: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
Nate Smith
c65ac4ae9d
Merge branch 'master' into glamour-markdown 2020-02-18 14:23:49 -06: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
Nicolas Martin
950144945f Use glamour as markdown rendering backend for issue & pr previews
glamour uses the CommonMark compliant Goldmark markdown parser instead of
go-termd which is based on Blackfriday.
2020-02-06 00:20:16 +01:00
Mislav Marohnić
fe7cdd8ab7 Extract web browser launching to a package
This fixes opening URLs with `&` on Windows.
2020-01-29 11:49:38 +01:00
vilmibm
d7d575fccb support more time units 2020-01-21 14:25:38 -06:00
vilmibm
a4b97014d1 stray TODO 2020-01-17 16:07:35 -06:00
vilmibm
a297153637 test for utils.FuzzyAgo 2020-01-17 15:57:02 -06:00
vilmibm
bfdf89b579 updated based sorting and fuzzy time display on issue status 2020-01-17 15:38:41 -06:00
vilmibm
daf02ff3ec de-inline go-termd 2020-01-13 16:10:22 -06:00
vilmibm
4592aaf63d clarify newline normalization 2020-01-13 15:36:43 -06:00
vilmibm
5bc6d220c4 review feedback 2020-01-13 15:32:07 -06:00
vilmibm
bc1ab20cdf turns out this has frightening state 2020-01-10 15:40:09 -06:00
vilmibm
e42b097629 inline a markdown rendering lib
This commit inlines https://github.com/tj/go-termd for a few reasons:

- off the shelf it relies on a broken, erroneously released version of
blackfriday (a markdown parser)
- based on discussion with ampinsk, there are some tweaks we'd like to
make to markdown rendering beyond what the library exposes now
- it's a small library (around 300 sloc)

This commit only:

- messes with go.mod to fix the blackfriday issues
- adds an inclusion note
- renames the package
2020-01-10 14:44:51 -06:00
vilmibm
4925c3cf01 preview PRs and issues in the terminal with -p 2020-01-10 11:41:26 -06:00
Mislav Marohnić
a0458956c0 Add docs to color funcs 2019-11-28 11:55:14 +01:00
Mislav Marohnić
e636e3e613 Merge remote-tracking branch 'origin/master' into cygwin-color 2019-11-28 11:52:45 +01:00
Mislav Marohnić
ebb7f39985 Merge remote-tracking branch 'origin/master' into ansi-colorfunc 2019-11-28 11:48:54 +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ć
24b04b5fca Make use of ansi.ColorFunc
Speed up repeated calls to color functions by using ansi.ColorFunc to
create a closure per each color.

https://godoc.org/github.com/mgutz/ansi#ColorFunc
2019-11-27 19:16:53 +01:00
Mislav Marohnić
004ab1e9db Fix color output to Git Bash 2019-11-27 18:58:23 +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ć
7f4833d84e 🔥 unused code 2019-11-26 14:14:31 +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ć
02b1f60a24 Merge remote-tracking branch 'origin/master' into table-output 2019-11-20 12:12:09 +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
Mislav Marohnić
2616da04c4 Only capture stderr of commands that don't have configured Stderr 2019-11-14 20:02:42 +01:00
Nate Smith
2236bd3f7b Merge pull request #51 from github/colors
do not use color when stdout is not a terminal
2019-11-12 11:25:54 -07:00
Mislav Marohnić
32e36d2fe0 Merge branch 'master' into exec-cmd-error-info 2019-11-06 19:36:12 +01:00
nate smith
ffa5ce456a do not use color when stdout is not a terminal 2019-11-06 10:15:27 -07:00
nate smith
e8634ca5d8 use mgutz/ansi in utils 2019-11-05 13:47:48 -07:00
Mislav Marohnić
531db42c47 Log executed git commands when DEBUG is active 2019-11-01 23:20:45 +01:00
Mislav Marohnić
f6fcdf114e Use SetPrepareCmd hook to spy on OpenInBrowser
We are now able to assert that the browse command was called with the correct URL
2019-11-01 22:18:12 +01:00
Mislav Marohnić
d881a2e52e Ensure git operations preserve their stderr in error output
This also provides a SetPrepareCmd hook for tests to be able to define stubs for commands that are supposed to be run
2019-11-01 22:16:23 +01:00
Corey Johnson
a8b7e4c5f3 Add PRView tests 2019-10-16 14:47:47 -07:00
Corey Johnson
9c218075fb Add bold 2019-10-15 14:55:15 -07:00
Corey Johnson
cff76fbc22 Use gookit for colors 2019-10-15 14:51:33 -07:00