* after merge, switch to base branch if available
* Add ability to checkout new branch
* Style cleanup
Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
I always get tripped up whenever trying to list my codespaces, adding
`ls` as an alias to `list` feels natural enough.
Co-authored-by: Mislav Marohnić <mislav@github.com>
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.
* pr-checks: extract webMode
* pr-checks: extract checks information collection
* pr-checks: extract output utilities
* pr-checks: implement watch flag
* pr-checks: remove SIGINT interceptor
* pr-checks: exit with error if some task has failed
* update flags help text
* update default interval to 10s
* move interval flag parse to RunE
* refactor checksRunWatchMode to use infinite loop
* Refactor printTable function
* Refactor collect function
* Set up checksRun to use new refactored functions and simplify logic a bit
* Add tests
* Always set interval in opts
* use Duration flag
* Revert back to using int flag for consistency with run watch
* Use run watch screen clearing mechanism
* Re-add pager support
Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
Add pager functionality to the following commands:
- gist list
- pr checks
- release list
- run list
- run view
- secret list
- workflow list
- workflow view
Additionally, normalize error handling when starting the pager has
failed: only print a non-fatal notice to stderr instead of aborting the
whole command.
If the base branch has no minimum approval requirements, show "N Approved"
reviews. Otherwise, show "N/X Approved".
Co-authored-by: Mislav Marohnić <mislav@github.com>
Both SurveyAsk and SurveyAskOne methods now share the same sets of
stubs, making it possible to change which of these methods is used in
the implementation without breaking tests.
A new method `AskStubber.StubPrompt("<prompt>")` is added as test helper
to supersede old Stub and StubOne methods. The new helper matches on
prompt messages rather than on field names, enabling tests to be written
based on what the user would see rather than coupling to implementation
details.
The new stubber also allows verifying whether a Select or MultiSelect
was rendered with the expected set of options. Furthermore, if a stubbed
value is not present among those options, the stubber will panic instead
of continuing normally.
Stubbed Selects with an int instead of a string target receiver are now
transparently handled. The values for Select stubs are always strings in
tests, but the stubber will write an int answer if the receiver expects
one as a selected index instead of a selected string value.
Lastly, this set of changes improves test resiliency since the stubs are
now matched based on prompt message (or field name for legacy stubs
created with Stub) instead of sequentially, enabling the implementation
to reorder the prompts without breaking existing tests.
Update labels using the `addLabelsToLabelable` and
`removeLabelsFromLabelable` mutations instead of via the `updateIssue`
mutation that replaces the entire set of labels. This prevents the edit
operation from clobbering any unseen changes to the list of labels.
Co-authored-by: Mislav Marohnić <mislav@github.com>
In the absence of an explicit `--color` setting, or when `--color=auto`
is passed, the pr diff command should fall back to respecting the global
colorization setting as inferred from the environment.
- `issue reopen` no longer fetches all issue fields and thus avoids the
problem when loading failed due to token not having access to projects
- `issue reopen` now accepts either issue or pull number as argument.
- `issue close` no longer fetches all issue fields and thus avoids the
problem when loading failed due to token not having access to projects
- `issue close` now accepts either issue or pull number as argument.
* 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>