Commit graph

59 commits

Author SHA1 Message Date
Mark Phelps
a9e92c9ed5
Fix HexToRGB panic (#5247) 2022-03-01 14:37:10 +00:00
Mislav Marohnić
0a5e220231 Ignore EPIPE errors when writing to a closed pager
While a gh command is writing stdout to a pager, the user may choose to
close the pager program before the pager has read all the data on its
standard input. In that case, the parent gh process will receive an
EPIPE error, which would bubble up its error handling and cause it to
print something like:

    write |1: broken pipe

Since this was caused by an explicit user action of closing the pager,
and since the user probably doesn't want to see this uninformative
error, this informs our global error handling of this error and causes
it to be ignored.
2022-02-10 16:42:00 +01:00
Mislav Marohnić
659eed777d Have TerminalTheme invoke DetectTerminalTheme if necessary 2022-01-14 15:42:02 +01:00
Mislav Marohnić
d02f184bd1 go fmt 2021-12-02 16:12:24 +01:00
Jose Garcia
bbea5ac95e
codespace: progress indication, logging (#4555)
* Rework logging, showing progress, and printing from `codespace` commands
* Change rendering of the general progress indicator so that it's visible on both dark and light backgrounds
* The progress indicator now "spins" faster

Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-10-21 18:04:04 +02:00
Heath Stewart
e2973453b5
Add helper template functions for rendering tables (#3519)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-08-23 21:00:25 +02:00
Heath Stewart
88af63d36f
Re-enable label colors for issue list (#4106)
* Re-enable label colors for issue list
* Drop parentheses wrapping issue labels
* Support ANSI escape codes in TablePrinter cells
* Switch to a Truncate implementation that correctly measures ANSI escape codes
* Only output RGB color if terminal has truecolor capabilities
* Enable `ENABLE_VIRTUAL_TERMINAL_PROCESSING` on Windows - fixes wrapping issues with full lines and allows truecolor rendering

Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-08-23 19:55:12 +02:00
Mislav Marohnić
0701f8aa82 Add tests for ForceTerminal 2021-08-23 16:09:08 +02:00
Mislav Marohnić
321fd98f82 Add ability to force terminal-style output even when redirected 2021-08-17 20:12:25 +02:00
bchadwic
47314a6bbc modified HexToRGB to check whether terminal and gh have color enabled, as well as created tests for HexToRGB 2021-07-03 17:09:25 -07:00
bchadwic
af2499cb69 renamed func RGB to HexToRGB 2021-06-29 22:35:23 -07:00
bchadwic
4c412bc88c Added in label rgb functionality for both prs and issues 2021-06-29 22:26:41 -07:00
Sam Coe
edfac42384
Set up iostreams in factory default 2021-06-15 09:20:00 -04:00
Cristian Dominguez
b3c2318e09 Increase GH_PAGER precedence
If `GH_PAGER` is exists, set it as the pager even if one is
already set in config.

This allows a user to change/disable the pager per single invocation.
2021-06-04 23:22:37 -03:00
Tobias Klauser
b586d51778 Use golang.org/x/term
The golang.org/x/crypto/ssh/terminal package is deprecated and merely a
wrapper around golang.org/x/term. Use the latter directly.
2021-04-28 18:44:36 +02:00
vilmibm
c8e481e165 gh run watch 2021-04-06 20:27:09 -05:00
Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated (#3286) 2021-03-30 16:51:00 +02:00
Nate Smith
126b498e9f
Actions Support Phase 1 (#2923)
* Implement first round of support for GitHub Actions

This commit adds:

gh actions
gh run list
gh run view
gh job view

as part of our first round of actions support. These commands are
unlisted and considered in beta.

* review feedback

* tests for exit status on job view

* spinner tracks io itself

* review feedback

* fix PR matching

* enable pager for job log viewing

* add more colorf functions

* add AnnotationSymbol

* hide job, run

* do not add method to api.Client

* remove useless cargo coded copypasta
2021-03-16 13:59:34 -07:00
Mislav Marohnić
f46bab256c Rename to SuccessIconWithColor 2021-01-25 14:56:39 +01:00
Mislav Marohnić
23d68705bc Match color of the success icon with the end state of the record 2021-01-22 23:55:33 +01:00
Sam Coe
c843a4fa13
Add issue comment viewing 2020-12-07 14:25:04 -05:00
vilmibm
d6e84a75fb switch to recover instead of resubmit 2020-11-23 11:21:34 -08:00
vilmibm
f68909b7a8 use TempFile though the testing is gross 2020-11-23 11:21:28 -08:00
vilmibm
d300526318 preserve and restore issue/pr input on failure 2020-11-23 11:21:28 -08:00
vilmibm
e92cd43259 add IOStreams.ReadUserFile 2020-11-23 11:21:28 -08:00
Mislav Marohnić
5b4a08dcb9 Ensure that only PATH is searched when shelling out to external commands
Works around https://github.com/golang/go/issues/38736 for Windows.
2020-11-11 16:33:13 +01:00
vilmibm
a2aa154794 port entirely to ColorScheme 2020-10-29 12:37:45 -07:00
Teubel György
9b2fe1ee30 Disable pager when set to "cat" 2020-09-29 23:21:59 +02:00
Teubel György
b71261219c Add support for GH_PAGER 2020-09-29 17:42:25 +02:00
Sam Coe
8f27cb35e9
Add tests 2020-09-25 08:50:24 +02:00
Sam Coe
f0d4fbf84f
Address PR comments around style and naming 2020-09-24 19:27:29 +02:00
Sam Coe
ed4075517c
Check for terminal background color before starting pager 2020-09-24 13:06:28 +02:00
Mislav Marohnić
88aacc14f0 Fix gray color presentation across terminals
We used to send the ANSI sequence for "bright black" when we wanted gray, but this color turns out to not be visible in some popular color schemes.

Instead, when we detect a 256-color terminal, switch to displaying a color sequence for gray that is consistent and does not depend on terminal color scheme.
2020-09-16 17:57:13 +02:00
Mislav Marohnić
086d8ed29a Merge remote-tracking branch 'origin' into color-env 2020-09-16 16:51:38 +02:00
Mislav Marohnić
f6dd1bcd0a Add the pager config option 2020-09-16 16:15:37 +02:00
Mislav Marohnić
76181156ba Prevent endless recursive pager
Unset PAGER environment variable when executing the command referenced
in PAGER in case that command also has support for PAGER and would end
up executing itself indefinitely.
2020-09-14 16:49:30 +02:00
Mislav Marohnić
b2e7f0c1e2 Merge remote-tracking branch 'origin' into pager-for-everyone 2020-09-14 14:18:42 +02:00
vilmibm
fcc0e75a50 do not pass entire config to iostreams 2020-09-10 12:13:48 -05:00
vilmibm
ecd1b34b39 Add prompt config setting and support in CanPrompt 2020-09-10 12:13:48 -05:00
vilmibm
5119d21137 support Config in IOStreams 2020-09-10 12:12:47 -05:00
Mislav Marohnić
ad0bbde351 Merge remote-tracking branch 'origin' into release-cmd 2020-09-09 15:27:49 +02:00
Mislav Marohnić
fae66a62e4 Fix measuring terminal width for output 2020-09-07 22:03:54 +02:00
Mislav Marohnić
d38a0c5d84 Encapsulate checking color-controlling environment variables 2020-09-07 13:10:43 +02:00
Mislav Marohnić
d01355e24b Add global PAGER support
Extract the ad-hoc PAGER behavior from `pr diff` command and make it
available opt-in to any command through IOStreams.
2020-09-04 23:07:17 +02:00
Mislav Marohnić
ca2f2b18ca Add support for CLICOLOR "standard"
The CLICOLOR_FORCE environment variable can now be used to force color
output even when stdout is redirected. https://bixense.com/clicolors/
2020-09-04 21:32:58 +02:00
nate smith
49ab3ec5bf check for tty before creating colorables 2020-09-01 11:18:34 -05:00
Mislav Marohnić
9b45112e69 Add tests for release list/delete 2020-08-28 19:26:16 +02:00
Mislav Marohnić
9a4a5d86cb Merge remote-tracking branch 'origin' into release-cmd 2020-08-28 17:47:53 +02:00
Mislav Marohnić
d43d5e0bc9 Add release delete 2020-08-28 17:41:00 +02:00
Mislav Marohnić
ac0b49dc00 Enable color ANSI escape sequences on stderr on Windows 2020-08-26 16:47:08 +02:00