Commit graph

81 commits

Author SHA1 Message Date
Heath Stewart
7738b6187c
Add headers to all tables (#8157) 2023-10-20 11:20:02 +02:00
Sam Coe
8016244dbb
Use go-gh prompter package (#7896) 2023-08-28 08:08:43 -05:00
Josh Kraft
d82c65ac2f change highlight color 2023-04-26 19:15:31 -06:00
Josh Kraft
b8f86f54ad Merge branch 'trunk' into gh-search-code 2023-04-26 18:48:24 -06:00
Josh Kraft
65720e498e implement code search
updates
2023-04-26 18:38:35 -06:00
Sam Coe
dbc2f05124
Update go-gh to v2 (#7299)
* Update go-gh

* Update code for go-gh v2
2023-04-16 15:34:23 +10:00
JP Ungaretti
1b88915a4d Rename f to run 2023-02-09 23:16:12 +00:00
JP Ungaretti
43783a33a2 Move helper to iostreams 2023-02-09 22:23:58 +00:00
Sam Coe
c066edc984
Fix commands that use iostreams RefreshScreen (#6607) 2022-11-14 16:08:00 +01:00
Mislav Marohnić
58b12bfd13
Fake terminal-like object in tests 2022-10-25 16:56:28 +02:00
Mislav Marohnić
66282b6819
Restore color override 2022-10-24 17:15:06 +02:00
Mislav Marohnić
25a926d5cb
Dogfood term package from go-gh 2022-10-11 14:29:50 +02:00
Mislav Marohnić
efe504eefc Fix color output for non-256 color terminals
The function enableVirtualTerminalProcessing must return an error if
virtual terminal processing (only applicable on Windows) was not
enabled, otherwise we assume that the terminal supports both 256-color
and truecolor.

We have been erroneously assuming that all non-Windows terminals are
256-color and sending escape sequences to those that cannot intepret
them. This led to some parts of Survey prompts being invisible on old
terminals.

Regressed in be4b392530
2022-09-27 19:50:05 +02:00
Eng Zer Jun
471cbea4fa
test: use t.Setenv to set env vars in tests (#6333)
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-26 08:46:02 +00:00
Mislav Marohnić
58ef50ae1f Ensure that subprocesses connect to the original os.Stdout
On non-Windows platforms, this avoids wrapping `IOStreams.Out` in a
`fdWriter` and thus causing subprocesses to lose connection to the
terminal that gh is connected to.
2022-09-14 16:47:42 +02:00
Mislav Marohnić
e2e8d697db
Fix closing IOStreams.Out after finishing writing to the pager (#6210) 2022-09-06 19:22:31 +02:00
Mislav Marohnić
436d9ef859
Fix "missing method Fd" crash on Windows (#6200)
This ensures that `IOStreams.Out` always keeps the original `Fd()` value even if it's wrapped as a Colorable stream for Windows in cases when enabling virtual terminal processing has failed.
2022-09-06 17:29:06 +02:00
Heath Stewart
c2f51f37bb Switch to main buffer on SIGINT
Fixes #6001
2022-07-26 20:47:33 -07:00
Heath Stewart
1ed80ffd45 Resolve PR feedback 2022-06-23 00:53:34 -07:00
Heath Stewart
be4b392530 Use alternate screen buffer for watching runs
Resolves #5679
2022-05-23 22:18:11 -07:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Heath Stewart
fc8739cf97
Add column for listing the label color (#5462)
Fixes #5448
2022-04-14 08:51:37 +02:00
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