Commit graph

29 commits

Author SHA1 Message Date
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
Mislav Marohnić
c095a4bead Allow explicitly specifying the hostname for gh operations
Accept the "HOST/OWNER/REPO" syntax or passing a full URL for both the
`--repo` flag and the GH_REPO environment variable and allow setting
GH_HOST environment variable to override just the hostname for
operations that assume "github.com" by default.

Examples:

    $ gh repo clone example.org/owner/repo
    $ GH_HOST=example.org gh repo clone repo

    $ GH_HOST=example.org gh api user
    $ GH_HOST=example.org gh gist create myfile.txt

    $ gh issue list -R example.org/owner/repo
    $ gh issue list -R https://example.org/owner/repo.git
    $ GH_REPO=example.org/owner/repo gh issue list
2020-08-12 16:16:34 +02:00
Mislav Marohnić
47cef736f4 Fix GH_REPO override 2020-08-07 14:47:58 +02:00
Mislav Marohnić
12637d02d6 Isolate pr review command 2020-07-29 19:35:54 +02:00
vilmibm
f3eb092d7e isolate repo fork command and tweak usage
This commit is another isolation refactor, this time for repo fork.
However, I got fed up with the --remote="true|false|prompt" style of
flags and took this opportunity to switch to a set of bool flags:

--remote and --clone
--no-remote and --no-clone

the string args were really non standard and confusing; with only two
bools it was impossible to tell when to prompt.
2020-07-27 13:04:31 -05:00
vilmibm
1831d95433 isolated clone command
This commit hacks the existing repo clone tests into something usable by
the new isolated command. It went ok and was less effort than trying to
introduce the same kind of test format as repo view and gist create.
2020-07-23 16:40:31 -05:00
vilmibm
d92c80b560 just swap BaseRepo implementation 2020-07-23 11:58:22 -05:00
vilmibm
2a99ed9afb add ResolvedBaseRepo 2020-07-23 11:01:29 -05:00
Mislav Marohnić
b838ac4014 Improve no args error handler and extend it to other commands 2020-06-15 21:01:32 +02:00
Mislav Marohnić
acf0046718 api command: support {owner} and {repo} placeholders
When `{owner}` and `{repo}` strings are found in request path (for REST
requests) or `query` (for GraphQL), they are replaced with values from
the repository of the current working directory.
2020-06-11 15:00:29 +02:00
Mislav Marohnić
bef62faaea Make NewCmdApi testable 2020-05-20 15:21:35 +02:00
Mislav Marohnić
d8146cd16e Extract cmdutil package 2020-05-20 15:21:31 +02:00