Commit graph

85 commits

Author SHA1 Message Date
Mislav Marohnić
69ca2dda4a Quick fix: respect default hostname when parsing owner/repo pairs
This re-enables using GH_HOST to set a default hostname when
supplying repo argument like `gh repo clone owner/repo`.
2021-04-02 15:16:27 +02:00
Mislav Marohnić
23b2594662 Fix crash when generating man pages
Fixes #3329
2021-03-30 19:59:39 +02:00
Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated (#3286) 2021-03-30 16:51:00 +02:00
Mislav Marohnić
c63247f0ea Avoid checking for new releases when authenticating git
Avoid displaying upgrade notice if any output is redirected. This also
alleviates the need to specifically check for `gh completion -s
<shell>`, `gh __complete`, and other scripting scenarios where we
absolutely don't want to trigger any upgrade checks or notices.
2021-03-04 17:39:25 +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ć
cfbfb578f0 Read Executable from factory instead of from stdlib 2021-03-04 13:41:50 +01:00
Mislav Marohnić
9234163679 Formalize gh process exit codes
Here are the statuses:
- 0: success
- 1: misc. error
- 2: user interrupt/cancellation
- 4: authentication needed

These old exit codes are now changed to "1":
- we used to return "2" for config file errors;
- we used to return "2" for alias expansion errors;
- we used to return "3" for alias runtime errors.

I do not believe that there is a need to distinguish these specific
cases via exit status, and converting them to "1" frees codes "2" and
"3" for more practical use.
2021-03-04 13:35:59 +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
Mislav Marohnić
27aea42d8a Avoid upgrade notice for recent release if gh is under Homebrew prefix
Before, when gh detected there was a new release in the `cli/cli` repo,
it would show this notice:

    A new release of gh is available: {V1} → {V2}

Additionally, when the release was more than 24h old, we would show this
to Homebrew users:

    To upgrade, run: brew update && brew upgrade gh

Ref. feb4acc2c0

This change makes it so that the original notice "A new release of gh is
available" is NOT shown to Homebrew users unless the release is older
than 24h. We effectively hide the fact that any release happened until
we're sure that the version bump has made it to `homebrew-core`.
2021-02-23 12:24:51 +01:00
Mislav Marohnić
feb4acc2c0 Suggest brew upgrade gh when new version detected
When the update notifier is enabled and a new version was detected, show
a Homebrew upgrade notice if:
- the release was at least 24 hours ago; and
- the current `gh` binary is under the Homebrew prefix.
2021-02-08 13:57:08 +01:00
Mislav Marohnić
2843ffff23 Classify the update package as internal 2020-12-15 16:09:08 +01:00
Nils Leif Fischer
413ccb71cc
Delete an error message that is not useful (and had a typo) 2020-11-30 13:20:43 +01:00
Sam Coe
2eb40f8a14
Empty auth token env variables are equal to being unset 2020-11-12 10:09:08 +03:00
Sam Coe
414de332fb
cleanup 2020-11-12 09:52:14 +03:00
Sam Coe
a79a0bbfd7
Add support for GH_TOKEN and GH_ENTERPRISE_TOKEN 2020-11-12 09:52:10 +03:00
Mislav Marohnić
5b4a08dcb9 Ensure that only PATH is searched when shelling out to external commands
Works around https://github.com/golang/go/issues/38736 for Windows.
2020-11-11 16:33:13 +01:00
Cristian Dominguez
79878a6736 Show MousetrapHelpText when double-clicking gh.exe 2020-11-09 08:28:55 -03:00
Sam Coe
f770c6481c
Generate markdown for help topics 2020-11-04 12:35:58 +03:00
Nate Smith
24d863eccc
Merge pull request #2316 from cli/colors-1624
migrate off of utils color functions
2020-11-03 12:49:02 -06:00
Nate Smith
e7d934678d
Merge branch 'trunk' into run_from_explorer 2020-11-02 18:23:16 -06:00
vilmibm
f519989d5c move cobra mutation and document it 2020-11-02 16:22:02 -08:00
Nate Smith
325cc3c078
Merge pull request #2256 from cli/internalize-docs
Internalize doc generation code
2020-11-02 12:31:37 -06:00
vilmibm
a2aa154794 port entirely to ColorScheme 2020-10-29 12:37:45 -07:00
Sam
edecb2e4f7
Merge pull request #2207 from cli/codespaces
[Codespaces] Support "integration" tokens
2020-10-27 15:37:02 +03:00
Mislav Marohnić
ae7d42a876 Centralize all known configuration options 2020-10-26 14:42:04 +01:00
Sam
699c9ae131
Remove Cobra autogenerated string from docs generation 2020-10-22 12:59:11 +02:00
Sam
36949e263a Internalize doc generation from Cobra 2020-10-22 09:38:51 +00:00
Sam Coe
f0b534f92e
Move build to internal 2020-10-21 13:31:32 +02:00
Sam Coe
9df3bd9344
Change command pkg to build pkg 2020-10-21 11:16:49 +02:00
Sam Coe
0f8084d039
Move functions from command/root to main 2020-10-21 10:46:09 +02:00
Mislav Marohnić
35517ebd77 Skip update notifier in Codespaces 2020-10-16 17:20:12 +00:00
Mislav Marohnić
ce8f37aca2 💅 tweak update notifier 2020-10-09 18:15:28 +02:00
ShubhankarKG
78b67fabdd 1. Added GH_NO_UPDATE_NOTIFIER to hhelp_topics
2. Updated test to check if passed variable is not empty
2020-10-08 21:22:26 +05:30
ShubhankarKG
3a22ab7eba Update shouldCheckForUpdate 2020-10-08 12:04:57 +05:30
Mislav Marohnić
b2de27c624 Fix Survey's presentation of default values
For default values for e.g. `Input` prompts, Survey uses the literal "white" color, which makes no sense on dark terminals and is literally invisible on light backgrounds.

This overrides Survey to output a gray color for 256-color terminals and "default" for basic terminals.
2020-09-16 17:57:13 +02:00
Mislav Marohnić
086d8ed29a Merge remote-tracking branch 'origin' into color-env 2020-09-16 16:51:38 +02:00
Mislav Marohnić
f6dd1bcd0a Add the pager config option 2020-09-16 16:15:37 +02:00
Nate Smith
5a8df475b9
Merge pull request #1639 from cli/disable-prompts
Support "prompt" config setting
2020-09-11 12:07:44 -05:00
vilmibm
2e95e279e3 reuse cfg reference 2020-09-11 11:38:26 -05:00
vilmibm
1073c97409 review feedback 2020-09-11 11:36:24 -05:00
Tony Rosler
4ef8a75ae2
Handle runtime error on bad user input (#1652) 2020-09-11 11:23:24 +02:00
vilmibm
fcc0e75a50 do not pass entire config to iostreams 2020-09-10 12:13:48 -05:00
Mislav Marohnić
a0e0f31363 Disable ANSI color in prompts when color is disabled 2020-09-07 13:10:43 +02:00
Mislav Marohnić
2bb5e052d8 Send GITHUB_TOKEN to github.com and GITHUB_ENTERPRISE_TOKEN to GHES 2020-09-04 17:25:37 +02:00
vilmibm
2850ef0e17 forgot to run goimports 2020-08-24 13:32:20 -05:00
vilmibm
f3d1f9e56e no ascii art 2020-08-24 13:29:51 -05:00
vilmibm
6408ae111c oops 2020-08-19 11:37:05 -05:00
vilmibm
cba401deb0 check parent annotatiosn for auth skip 2020-08-19 10:21:19 -05:00
vilmibm
9975cbf291 whitespace 2020-08-19 10:16:13 -05:00