Commit graph

81 commits

Author SHA1 Message Date
Andy Feller
3bb5f54073 Apply first round of owner/repo#number consistency
This commit expands on @nobe4 initial work by bringing the owner and repository name to the most obvious issue and PR number output use cases before making a second pass for any edge cases.
2024-03-01 14:03:18 -05:00
Florian Forster
7164f6e225
fix: Prevent nil dereference in pr view. (#8566)
The API may return a `null` project, maybe related to "legacy projects". This
is translated to a nil pointer in Go. When accessing `project.Column`, the nil
pointer was dereferenced, causing a segmentation fault.
2024-01-17 22:12:22 +00:00
Yukai Chou
afbdb945bc Small docs tweaks 2023-11-23 07:14:38 +08:00
Yukai Chou
17d336e005 Wrap cli flags in backticks uniformly 2023-11-16 22:54:27 +08:00
ffalor
31ffa6b499
Alphabetically sort labels for pr/issue view (#7587) 2023-06-20 11:30:03 +09:00
William Martin
04ecac9a6f Rework state parsing for CheckRuns and StatusContexts 2023-05-23 16:51:08 +02:00
Martijn Pieters
0da0de4022
Include auto-merge information in gh pr view (#7385) 2023-05-10 08:39:52 +12:00
lpessoa
fb6f538f88
Adding no checks message when PR has no checks
Including additional tests.
2022-10-05 22:10:38 -03:00
lpessoa
6246f89690
Adding new tests for 'view' and 'shared display'
Added all passed, all failed, some failed and pending scenarios.
Added tests for PrCheckStatusSummaryWithColor.
2022-09-19 16:41:01 -05:00
lpessoa
742b50c929
Adding new tests for 'view' and 'shared display'
Added all passed, all failed, some failed and pending scenarios.
Added tests for PrCheckStatusSummaryWithColor.
2022-09-19 16:37:22 -05:00
lpessoa
e8767b9706
feat: adding checks at GH PR view
Fixes #6117

Adding checks to PR view as a new line along with changes information.
Isolated 'status' display logic into a shared method in order to reuse it in 'view'.
Updated existing 'view' tests.

TODO: add new tests for PRs with checks.
2022-09-16 13:56:10 -03:00
Sam Coe
e7102f9d84
Migrate to go-gh text package (#6236) 2022-09-14 09:23:55 +04:00
Mark Woods
e876b22963
Change markdown wrap limit match terminal width (#6016) 2022-09-01 07:36:25 +00:00
Nate Smith
1da31c8b8f
Merge pull request #6085 from satotake/add-age-to-pr
Add age field to `pr list` / `pr view`
2022-08-23 11:55:29 -05:00
Sam Coe
6a8deb1f5a
Integrate latest go-gh packages (#6084) 2022-08-18 09:04:13 +03:00
satotake
61e0c5a294 Add age field to pr view 2022-08-17 02:02:53 +09:00
Sam Coe
d244346960
Replace uses of strings.Title (#5623) 2022-05-12 13:52:21 +00:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Callum Macrae
f7ef503051 fix: respect GH_FORCE_TTY when running gh pr view
`GH_FORCE_TTY` only affects stdout, not stderr, so this check was
failing and the flag was being ignored.

I also checked for similar problem in other files but everything else
seemed stderr or stdin related.

closes #5354
2022-03-25 15:07:47 +00:00
Mislav Marohnić
4a3ef50d2d
Standardize pager output across commands (#5141)
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.
2022-02-01 08:36:51 +01:00
Mislav Marohnić
456d55ead9 Have a single Render function handle all Markdown rendering 2022-01-13 19:39:43 +01:00
Alan Donovan
f4491c7a80 Add FlagErrorf; encapsulate FlagError.error 2021-10-21 11:40:20 -04:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +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
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
jack1142
6a74eb1262
Merge branch 'trunk' into patch-1 2021-06-02 11:10:25 +02:00
jack1142
184149b844
Add missing new line 2021-06-01 23:53:58 +02:00
jack1142
3943a8bb1f
Update PR tty view formatting and its tests 2021-05-29 04:44:34 +02:00
Mislav Marohnić
1a980e768c Fix how teams are displayed in requested reviewers
1. The `--json` export now only renders the `login` field for User types
   and `name` and `slug` fields for Team types.
2. The `pr view` command now renders team reviewers in the format of
   `ORG/SLUG` instead of the team name. This is so that the same value
    can be used in the `pr create -r` flag.
2021-05-28 14:32:31 +02:00
Mislav Marohnić
42155c7d2d Export more IDs in issue/pr JSON payload 2021-05-18 18:19:28 +02:00
Mislav Marohnić
e758f30073 Fix preloading of pr reviews, checks, and issue/pr comments 2021-05-18 17:13:27 +02:00
Mislav Marohnić
bc3bb97c43 Merge remote-tracking branch 'origin' into pr-lookup-refactor 2021-05-17 17:41:38 +02:00
Mislav Marohnić
5f0301c990 Have Exporter.Write automatically call ExportData on given data structure 2021-05-12 17:05:15 +02:00
Mislav Marohnić
c50d390cf5 Fix tests 2021-05-07 22:09:58 +02:00
Mislav Marohnić
9bdc63c4ca Eliminate API overfetching in pr commands
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.
2021-04-30 20:34:36 +02:00
Mislav Marohnić
516ea8691e Fix whitespace formatting of issue/pr view help text 2021-04-14 20:04:47 +02:00
Mislav Marohnić
56cdbb643f Fix pr view tests broken by createdAtsubmittedAt switch 2021-04-14 19:41:55 +02:00
Mislav Marohnić
3ad41e3e65 Change JSON Exporter to an interface 2021-04-14 18:15:52 +02:00
Mislav Marohnić
abe452bb19 Add --json export flag for issues and pull requests
The `--json` flag accepts a list of GraphQL fields to query for and
output in JSON format. To get the list of available flags, run the
command with a blank value for `--json`. Additional `--jq` and
`--template` flags are available just like in `gh api`.
2021-04-13 20:29:31 +02:00
Mislav Marohnić
111e8dbcf2 Pass web browser to each individual command
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.
2021-03-19 21:22:37 +01:00
Nate Smith
2ab073d599
Refactor use of glamour to allow style overrides (#3243)
* Refactor use of glamour to allow style overrides

* leave the things the way they were and just expose the ability to set overrides
2021-03-19 16:29:32 +00:00
Gowtham Munukutla
1d8dd2f1e9 add tests for additions and deletions 2021-03-06 15:02:16 +05:30
Gowtham Munukutla
f2489ed22f reduce arg length to fprintf 2021-03-05 14:05:41 +05:30
Gowtham Munukutla
bdd663e658 Add additions and deletions in pr view raw as well 2021-03-05 13:41:25 +05:30
Gowtham Munukutla
9944698665 Add additions and deletions in pr view 2021-03-05 11:20:49 +05:30
Mislav Marohnić
051fbbc1e1 Merge remote-tracking branch 'origin' into dpromanko/remove-set-cmd-prepare 2021-01-28 22:00:08 +01:00
Devon Romanko
2964895a77 fix test behavior changes from migration to run.Stub 2021-01-27 18:46:29 -05:00
Sam Coe
52bdcad8ea
Do not display minimized comments 2021-01-27 08:14:46 -08:00