Commit graph

111 commits

Author SHA1 Message Date
Roshan Padaki
13342cb272
Don't error on list commands when no results found (#5479)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-04-25 17:55:52 +00:00
xiaotong
4a5864708c
Add label list and label create commands (#5316) 2022-03-29 17:38:59 +00:00
Sam Coe
e0045f26b9
Add top level search command and search repos sub command (#5172) 2022-03-09 12:24:27 +00:00
Mislav Marohnić
19563c4a74 Use StringEnumFlag helper in more places 2022-02-18 12:52:47 +01:00
Jonathan Mayer
1eefda0b45
gh auth login: add git protocol flag (#5158)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-02-17 19:35:59 +00:00
Mislav Marohnić
3cce16e72d Refactor factory.Executable() to be a method rather than a func
This way, factory can satisfy an interface that requires `Executable()`.
2021-12-21 13:50:55 +01:00
Gowtham Munukutla
98217fc38c gh repo edit
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-12-07 19:28:29 +01:00
rsteube
d794a929da
Fix stack overflow in AddJSONFlags (#4614)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-10-27 14:56:59 +02:00
Mislav Marohnić
83a08aa3ba Remove unnecessary pointers to Go maps 2021-10-25 17:20:12 +02:00
Alan Donovan
f4491c7a80 Add FlagErrorf; encapsulate FlagError.error 2021-10-21 11:40:20 -04:00
Alan Donovan
7215522123 use FlagError 2021-10-21 10:06:11 -04:00
Mislav Marohnić
d853ce5bc9 Avoid resolving executable() until requested at runtime
This is to avoid hitting the filesystem and resolving symlinks
unnecessarily. The value of executable is just used conditionally by a
handful of commands.
2021-09-24 14:42:41 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Cuong Manh Le
6cf6bb4a44 Disable auth for cobra shell request completion hidden commands
Those hidden command are used by the shell completion scripts, but they
are not disabled auth check. Thus, the shell completion does not work
even the completion setup was done properly.

Fixes #4188
2021-08-25 01:35:49 +07: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
Mislav Marohnić
4b499be96b
Merge pull request #3942 from dscho/complete--repo-flag
Allow auto-completing the `--repo` values
2021-07-28 17:27:56 +02:00
Mislav Marohnić
d6b70beeaa List repos from non-default hostnames in completions for -R 2021-07-28 17:18:56 +02:00
Johannes Schindelin
b43f78bc19 completions: auto-complete --repo values
Looking at the locally-registered remotes, we have a pretty good idea
what `--repo` values are available. Let's complete them.

Helped by Nate Smith and Mislav Marohnić.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-07-28 15:36:30 +02:00
Mislav Marohnić
4d7625c8a0 Allow shell-completing multiple --json fields separated by commas 2021-07-21 16:12:38 +02:00
Sam
33c3fb5cdd
Merge pull request #3870 from cli/extensions-revisited
Improvements to gh extensions
2021-06-28 17:12:29 -07:00
Mislav Marohnić
1ec47d8191 Improvements to gh extensions
- Extensions on Windows now enabled through the `sh.exe` interpreter
- `sh.exe` now found on Windows when git was installed via scoop
- `gh extensions list` command shows origin repo for the extension
- `gh extensions upgrade --all` is required to upgrade all extensions
- Added `gh extensions remove`
- Shell completions now include aliases and extension names
- `gh` help output now lists available extension names
- Extensions are stored to XDG_DATA_HOME
2021-06-21 16:54:08 +02:00
Mislav Marohnić
8ff42bf28c Fix repo override 2021-06-17 17:58:46 +02:00
Mislav Marohnić
8dd1e12f64 Merge remote-tracking branch 'origin' into fix-actions-help 2021-06-17 16:13:34 +02:00
Mislav Marohnić
883943946a Add a global pre-run hook to handle auth check and repo override
With auth check being done via Cobra hooks, it is automatically skipped
for non-runnable commands and `-h/--help` flag usage.
2021-06-17 16:01:57 +02:00
Sam Coe
53fac59ef9
Cleanup factory/default and add tests 2021-06-15 09:19:16 -04:00
Mislav Marohnić
301a35eedc
Merge pull request #3621 from cli/export-data
Push data serialization concern into Exporter
2021-05-17 13:43:00 +02:00
Mislav Marohnić
b09c1f7a6f Add shell completion for the --json flag 2021-05-12 17:35:17 +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ć
654bd29ca0 Disallow unsupported values for --json flag 2021-04-14 19:58:58 +02:00
Mislav Marohnić
625505dcfb Fix assigning null Exporter 2021-04-14 19:11:08 +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
Mislav Marohnić
4e24f36495 Declare --jq, --template, --silent options mutually exclusive 2021-03-04 17:29:59 +01:00
Mislav Marohnić
aa5cf6c48a
Merge pull request #3075 from cli/credential-helper-absolute
Use absolute path when configuring gh as git credential
2021-03-04 13:51:24 +01:00
Mislav Marohnić
e96d974331
Merge pull request #3023 from cli/cancel-error-status
Issue/pr create: exit with nonzero status code when "Cancel" was chosen
2021-03-04 13:45:11 +01:00
Mislav Marohnić
98f1f5ec0d Use absolute path when configuring gh as git credential
This keeps git operations working even when PATH is modified, e.g. `brew
update` will work even though Homebrew runs the command explicitly
without `/usr/local/bin` in PATH.

Additionally, this inserts a blank value for `credential.*.helper` to
instruct git to ignore previously configured credential helpers, i.e.
those that might have been set up in system configuration files. We do
this because otherwise, git will store the credential obtained from gh
in every other credential helper in the chain, which we want to avoid.

Before:

    git config --global credential.https://github.com.helper '!gh auth git-credential'

After:

    git config --global credential.https://github.com.helper ''
    git config --global --add credential.https://github.com.helper '!/path/to/gh auth git-credential'
2021-03-03 16:20:21 +01:00
Mislav Marohnić
3444d00bee
Merge pull request #3018 from castaneai/pr-create-body-file
Add `pr create --body-file` flag
2021-03-02 15:21:17 +01:00
Mislav Marohnić
dd34cae112 Merge remote-tracking branch 'origin' into cancel-error-status 2021-03-02 13:52:07 +01:00
Mislav Marohnić
2ebdde1ddd Exit with status code "2" on user cancellation errors
This also stops printing "interrupt" after Ctrl-C is pressed.
2021-03-02 13:48:44 +01:00
Gowtham Munukutla
66d4307bce return msg instead of too many arguments 2021-02-24 18:05:11 +05:30
Gowtham Munukutla
56ead91702 Add helper function to validate exact args in cmdutil 2021-02-24 15:49:40 +05:30
Mislav Marohnić
fee7adf9ba Add issue create -F <file> flag and tests 2021-02-23 14:25:32 +01:00
Sam Coe
e21c5100fa
Properly check env auth tokens in CheckAuth 2020-12-01 11:44:14 -05:00
Alisson Santos
cf617e88f4 Extract repeated code to util function 2020-11-03 22:05:04 +01:00
Sam Coe
101bb90ab5
Add host back into repo flag description 2020-10-22 17:51:16 +02:00
Sam Coe
3f3c781ab6
Remove square brackets from persistent flag description to fix zsh autocomplete 2020-09-16 11:47:15 +02:00
vilmibm
cba401deb0 check parent annotatiosn for auth skip 2020-08-19 10:21:19 -05:00
vilmibm
0d48e8de59 linter appeasement 2020-08-18 18:03:48 -05:00
vilmibm
850a7ef243 print nice login message when no auth detected 2020-08-18 17:57:52 -05:00