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.
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.
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`.
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.
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.