Commit graph

2061 commits

Author SHA1 Message Date
Corey Johnson
41e67aa3e7 Fix typo 2020-05-22 10:04:02 -07:00
Mislav Marohnić
108f7bd66c Dirty workaround to display helpful error message on mistyped subcommands
When executing `gh pr re` (note the incomplete command name), Cobra
would just display the help text for `gh pr` on standard output, exit
with status 0, and not print any message that you have mistyped the
"re" subcommand. Each part of this behavior is wrong.

This workaround makes sure that the helpful error message is printed on
stderr:

    $ gh pr re
    unknown command "re" for "gh pr"

    Did you mean this?
            reopen
            ready
            review

However, the exit status is still 0, whereas it should be non-zero.
Since `HelpFunc` does not return an error argument, we cannot trigger an
error status from this workaround.
2020-05-22 19:02:34 +02:00
Mislav Marohnić
a33c00d389 Merge remote-tracking branch 'origin/master' into cobra1.0 2020-05-22 18:21:35 +02:00
Mislav Marohnić
1f3725c94d Use @me to avoid having to look up current user in pr status 2020-05-22 15:58:57 +02:00
Mislav Marohnić
331deb852b
Merge pull request #975 from cli/pr-reviewers-crash
Avoid crash in `pr view` with reviewers
2020-05-22 15:46:37 +02:00
Corey Johnson
a8fa9a2dfc Merge remote-tracking branch 'origin/merge-interactive-merge' into remote-delete 2020-05-20 18:21:45 -07:00
Corey Johnson
51162aa80c Merge remote-tracking branch 'origin/master' into merge-interactive-merge 2020-05-20 18:20:12 -07:00
Corey Johnson
479707d349 Merge remote-tracking branch 'origin/master' into remote-delete 2020-05-20 18:19:55 -07:00
vilmibm
5f28751555 just use a map + stdin test 2020-05-20 17:44:09 -05:00
vilmibm
f6137fa6ae handle json error in test 2020-05-20 17:16:59 -05:00
vilmibm
509be34af6 Merge remote-tracking branch 'origin/master' into wingkwong/master 2020-05-20 17:08:31 -05:00
vilmibm
f644c11edb tweak test 2020-05-20 17:03:56 -05:00
vilmibm
7453449d9a improve docs 2020-05-20 17:01:28 -05:00
Corey Johnson
ae70a814bd Update tests 2020-05-20 14:53:52 -07:00
vilmibm
93dc62f1b3 handle piped STDIN 2020-05-20 16:51:50 -05:00
Corey Johnson
80bdd1e071 print error 2020-05-20 14:36:09 -07:00
vilmibm
466edf8d0e take files as args. handle - 2020-05-20 16:27:28 -05:00
Corey Johnson
904c541d2d Only delete local branch if it exists 2020-05-20 14:19:44 -07:00
Corey Johnson
a303dabc5d Add remote deletion 2020-05-20 13:47:29 -07:00
Nate Smith
4e73c83fd1
Merge pull request #978 from cli/fix-linter
Fix lint errors
2020-05-20 13:59:07 -05:00
Corey Johnson
e5b78d3342 Fix lint errors 2020-05-20 11:21:05 -07:00
Corey Johnson
46a1e3cd53 Remove convertRepoInterfaceToRepository 2020-05-20 11:19:31 -07:00
Corey Johnson
5d99c56456 combine conditionals 2020-05-20 09:21:59 -07:00
Corey Johnson
b4783dd192 don't always switch to the default branch 2020-05-20 09:00:39 -07:00
Mislav Marohnić
d9e39226ca Clean up unused struct field
https://github.com/cli/cli/pull/976/checks?check_run_id=693382299
2020-05-20 17:41:33 +02:00
Mislav Marohnić
db9014fd7f Respect auth token from GITHUB_TOKEN environment variable
If GITHUB_TOKEN is non-blank, it overrides authentication info found in
the config file. The config file is, in fact, never consulted.
2020-05-20 17:35:10 +02:00
Corey Johnson
76368f92ee Return error 2020-05-20 08:32:08 -07:00
Corey Johnson
c3c3058b96 Merge remote-tracking branch 'origin/master' into merge-interactive-merge 2020-05-20 08:30:17 -07:00
Corey Johnson
1eedfe18bb Update default text 2020-05-20 08:26:34 -07:00
Mislav Marohnić
767521c055 Stop providing AuthLogin from context
The login name of the authenticated user will be readily available only
if authentication info comes from the config file. With other upcoming
authentication modes (for example, the GITHUB_TOKEN environment
variable), the token is the only piece of information we got, so we
would need to additionally query for the login name.

Since `issue status` and `pr status` are the only commands that need the
name of the authenticated user right now, have those commands explicitly
query for the login name. This results in an additional API query, but
simplifies Context implementation and future authentication approaches.
2020-05-20 17:09:13 +02:00
Nate Smith
e9d6e13339
Merge pull request #915 from mtfurlan/docs/manpage
Generate manpages from cobra
2020-05-20 09:58:50 -05:00
Mislav Marohnić
ea3a55c3d6 Ensure that cobra command tests don't write to system stdout/stderr 2020-05-20 16:28:35 +02:00
Mislav Marohnić
292b428465 Add test for showing response headers 2020-05-20 16:28:27 +02:00
Mislav Marohnić
bef62faaea Make NewCmdApi testable 2020-05-20 15:21:35 +02:00
Mislav Marohnić
f58e0bf710 Add api tests 2020-05-20 15:21:32 +02:00
Mislav Marohnić
d8146cd16e Extract cmdutil package 2020-05-20 15:21:31 +02:00
Mislav Marohnić
4c762d5bd7 Add iostreams package 2020-05-20 15:21:31 +02:00
Mislav Marohnić
a7100b1fdd Extract parseFields to a func 2020-05-20 15:21:31 +02:00
Mislav Marohnić
7ffbde3e12 Allow setting multiple values for a request header 2020-05-20 15:21:31 +02:00
Mislav Marohnić
90fa193eaf Promote api command to a pkg/cmd/api package 2020-05-20 15:21:31 +02:00
Mislav Marohnić
fa3e25bb4d Serialize GraphQL parameters under variables 2020-05-20 15:21:31 +02:00
Mislav Marohnić
1609afe993 Add api command 2020-05-20 15:21:31 +02:00
Mislav Marohnić
fb63efcf05 Avoid crash around "DISMISSED" or "PENDING" reviewer states 2020-05-20 14:59:40 +02:00
Mislav Marohnić
6385c32031 Include license information in release archives 2020-05-20 13:15:44 +02:00
Mislav Marohnić
a9e83dcc36 Tweak release process re: man pages 2020-05-20 13:07:48 +02:00
Mark Furland
af93bab887 remove unnecessary mkdir from makefile 2020-05-19 22:42:44 -04:00
Mark Furland
6387078532 add make manpages hook and fix makefile 2020-05-19 22:40:14 -04:00
Mark Furland
db2fac93ea generate manpages into ./share/man/man1 2020-05-19 18:43:26 -04:00
Corey Johnson
9185bf9a77 Return an error 2020-05-19 13:52:22 -07:00
Corey Johnson
5c113d02c8 Big M 2020-05-19 13:39:36 -07:00