Commit graph

167 commits

Author SHA1 Message Date
Nate Smith
619ef43f76
Merge pull request #1191 from cli/shell-alias
shell aliases
2020-07-15 12:24:36 -05:00
vilmibm
86912b31b2 stub sh lookup 2020-07-15 12:17:36 -05:00
vilmibm
cfb8eebf30 quietly return exit code of external command 2020-07-15 11:39:48 -05:00
vilmibm
acaaa28fd7 helper function for finding sh 2020-07-15 11:30:20 -05:00
Mislav Marohnić
c8cf54c10c
Merge pull request #1258 from cli/ghe-remotes
Parse and respect non-github.com git remotes
2020-07-15 13:07:30 +02:00
nate smith
4bd0435c38 successfully use sh for windows aliases 2020-07-14 16:19:01 -05:00
vilmibm
f99b54a731 WIP: experimental bash support for windows 2020-07-14 16:13:00 -05:00
vilmibm
bbd756a99f split shell alias execution into new function 2020-07-14 16:13:00 -05:00
nate smith
c3a5384895 add experimental powershell support for shell aliases 2020-07-14 16:12:51 -05:00
vilmibm
3a9167cfe4 Implement shell aliases
This command adds --shell to `gh alias set`, allowing specified aliases
to be run through a shell interpreter.
2020-07-14 16:12:07 -05:00
vilmibm
36ade42ba3 scriptability improvements: issue commands
This commit is part of work to make gh more scriptable. It includes both
some general purpose helpers towards this goal as well as improvements
to the issue commands. Other commands will follow.

- Adds `utils/terminal.go` for finding out about gh's execution environment
- introduces `stubTerminal` for either faking being attached to a tty or not during tests
- updates issue commands to behave better when not attached to a tty:
  - issue list doesn't print fuzzy dates
  - issue list doesn't print header
  - issue list prints state explicitly
  - issue create no longer hangs
  - issue create fails with clear error unless both -t and -b are specified
  - issue view prints raw issue body
  - issue view prints metadata in a consistent, linewise format
2020-07-14 12:30:53 -05:00
Mislav Marohnić
87a9dc8d4b Merge remote-tracking branch 'origin' into ghe-remotes 2020-07-13 13:39:14 +02:00
Mislav Marohnić
a68cefadd9 Merge remote-tracking branch 'origin' into ghe-remotes 2020-07-02 20:37:33 +02:00
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
Mislav Marohnić
e4448c73e4 Respect original hostname in formatRemoteURL() 2020-06-23 20:06:50 +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