Commit graph

153 commits

Author SHA1 Message Date
Mislav Marohnić
ac7b56fc61 Fix linter warning about sprintf within println 2020-07-02 17:01:37 +02:00
Mislav Marohnić
cd5a0d69fb :nail_polish: be clearer about the value passed to ResolveRemotesToRepos
`repo` will always be blank here, so replace the argument with a blank
literal instead.
2020-07-02 12:36:31 +02:00
Corey Johnson
625b673b58 Ignore repo flag errors in determineBaseRepo 2020-06-22 15:30:22 -04:00
Corey Johnson
8a4872bab3 Remove global repo flag 2020-06-22 14:07:49 -04:00
Mislav Marohnić
9c75cff94b Show command usage output on invalid flags being passed 2020-06-16 13:58:01 +02:00
Nate Smith
db74ea051e
Merge pull request #1165 from cli/api-repo-placeholders
api command: support `{owner}` and `{repo}` placeholders
2020-06-11 15:18:43 -05:00
Mislav Marohnić
0dfc0f733f Fix indentation of Example blocks
In HTML, `Example` blocks seem to be already injected in fenced Markdown
blocks `` ``` ``, so they don't need to be especially intented.
2020-06-11 20:31:37 +02:00
Mislav Marohnić
e6a0c3dc28 Fix EXAMPLES sections of various commands
- Code should be intented per Markdown syntax for a code block. This
  matters when this documentation is rendered to HTML

- Fix some innaccurate usage examples

- Tweak wording, formatting in a few places
2020-06-11 18:47:57 +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
Corey Johnson
7d7a010739 Clear out usage func 2020-06-10 09:43:24 -07:00
Corey Johnson
4931892cc3 Apply changes that were lost in merge conflict 2020-06-10 09:30:35 -07:00
Corey Johnson
56f1315d5f Merge remote-tracking branch 'origin/trunk' into h-e-l-p 2020-06-10 09:28:40 -07:00
Corey Johnson
a6948423f4 Update issue and pr help 2020-06-09 09:33:22 -07:00
Corey Johnson
51353c79d6 Use cobra Example field 2020-06-09 08:43:22 -07:00
Nate Smith
28f91cbed8
Merge pull request #1107 from vilmibm/move-credits
minor credits polish
2020-06-08 15:17:52 -05:00
vilmibm
e2ef712e43 use Command.Hidden 2020-06-08 12:31:40 -05:00
Mislav Marohnić
f976056126
Merge pull request #1109 from gedenata/remove-strict-link
remove strict ">" when click link

Closes #1126
2020-06-08 13:56:07 +02:00
vilmibm
8963d80942 better get func 2020-06-05 13:09:04 -05:00
gedenata
61e0a6c68f remove strict when click link 2020-06-05 12:34:33 +08:00
vilmibm
bd4bac962a use Annotations to hide commands 2020-06-04 16:42:32 -05:00
Corey Johnson
4d182c4314 Better help command 2020-06-04 12:51:26 -07:00
Mislav Marohnić
1f616859fc Merge remote-tracking branch 'origin' into auth-split 2020-06-04 12:00:19 +02:00
vilmibm
7014145a81 linter appeasement 2020-06-03 15:05:44 -05:00
vilmibm
a3a6f25024 do not use string concatenation for extra args 2020-06-02 16:07:24 -05:00
vilmibm
e37b517211 better placeholder handling 2020-06-02 11:26:44 -05:00
vilmibm
bace327634 pass rest of args through 2020-06-02 11:26:44 -05:00
vilmibm
f84707b5b1 args length check; needs test 2020-06-02 11:26:44 -05:00
vilmibm
09fa75e141 implement gh alias set 2020-06-02 11:26:44 -05:00
Mislav Marohnić
77227a6c50 Trigger OAuth flow only when requesting auth token
Previously we would trigger OAuth flow when the config file did not
exist. Now we will let an empty Config object be initialized in that
case, but trigger OAuth flow when the Context caller requests an
AuthToken.
2020-06-02 13:24:39 +02:00
Mislav Marohnić
eab5af9449 Merge remote-tracking branch 'origin' into cobra1.0 2020-05-28 15:15:20 +02:00
Mislav Marohnić
13ba0aa56e Respect GITHUB_TOKEN in api command 2020-05-27 13:09:05 +02:00
Mislav Marohnić
2e93a065b1 Merge remote-tracking branch 'origin/master' into api-command 2020-05-27 12:56:06 +02:00
Mislav Marohnić
c6643821dc Don't offer to reauthenticate for gist if GITHUB_TOKEN is used 2020-05-27 11:57:03 +02:00
Mislav Marohnić
ab0e43c6c8 Merge remote-tracking branch 'origin/master' into auth-from-env 2020-05-27 11:44:19 +02: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
vilmibm
509be34af6 Merge remote-tracking branch 'origin/master' into wingkwong/master 2020-05-20 17:08:31 -05: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
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
Mislav Marohnić
90fa193eaf Promote api command to a pkg/cmd/api package 2020-05-20 15:21:31 +02:00
Mislav Marohnić
4d11732a47
Merge pull request #943 from cli/reauth-bug
pass apiClient to determineBaseRepo
2020-05-18 13:16:07 +02:00
Kevin Bluer
d440a95aed
Improved error message when "owner/repo" format not provided (#919)
Fixes #882
2020-05-18 11:13:48 +02:00
vilmibm
780875d645 fix tests 2020-05-15 16:47:11 -05:00
vilmibm
96ba1eacef undo initial thing 2020-05-15 16:44:51 -05:00
vilmibm
bf05975ceb Revert "small repo fix"
This reverts commit 08e9cdaee1.
2020-05-15 16:40:47 -05:00
vilmibm
7decae71fc untested first pass on ensureScopes 2020-05-15 16:40:13 -05:00
vilmibm
c8c807b954 pass apiClient to determineBaseRepo
Our code had an unspoken assumption that only one apiClient is created
during the course of a command. Violating this assumption is fine in
almost all cases, but not when we need to do a re-auth to add a new
oauth scope to a user's token.

There is likely a more elegant solution to the problem but until then
this changes determineBaseRepo to use an existing apiClient.
2020-05-15 15:29:33 -05:00
vilmibm
08e9cdaee1 small repo fix 2020-05-15 10:25:40 -05:00
vilmibm
3b62d79e81 notes 2020-05-15 09:52:06 -05:00
vilmibm
a62f2987c0 stray debug 2020-05-13 14:59:14 -05:00