This commit converts all of the places using ColorScheme.Gray and ColorScheme.Grayf to Muted and Mutedf.
There is a little extra tidying up with local variable names or converting code to use Mutedf format.
Closes#10013
This commit enhances `gh pr checks` to exit with an error when mutually exclusive `--json` and `--watch` flags are used. Users are encouraged to either 1) retrieve information about the checks via `--json` or 2) watch and wait on PR checks that are being updated.
While the `state` field corresponds 1:1 with different GitHub Actions
states, the `bucket` field is an abstraction of the CLI that lacked
documentation. This both adds documentation about the existence of the
`bucket` field and enumerates the possible values.
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.
This switches `run list` and `run view` commands to measure how long ago did the run happen by using `run_started_at`, which is the timestamp of the latest run in a series, instead of `created_at`, which is the timestamp of the first run. This change also fixes accurate duration for in-progress runs.
* 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.
This completely rewrites the PR lookup mechanism so that the caller
must specify the GraphQL fields to query for each PR. Additionally, this
fixes some export problems with `pr view --json`.
Features:
- Each pr command now gets assigned a concept of a Finder. This makes it
easier to stub the PR in tests without having to stub the underlying
HTTP calls or git invocations.
- `pr view --web` is much faster since it only fetches the "url" field.
- `pr diff 123` now skips a whole API call where a whole PR was
unnecessarily preloaded just to access its diff in a subsequent call.
- PullRequestGraphQL query builder is now used to construct queries.
- A bunch of individual commands are now freed of having to know about
concepts such as BaseRepo, Branch, Config, or Remotes.
Previously, unrecognized Checks statuses would crash the program. For
the sake of supporting the "WAITING" status and for
forward-compatibility, this treats any unrecognized status as "pending".
This removes sensitivity to the BROWSER environment variable in tests
and makes it easier to verify the URL that the browser was invoked with
without having to stub sub-processes.