-
Couldn't load subscription status.
- Fork 7.3k
Improve documentation and error messaging for local extension installations without executables #9933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation and error messaging for local extension installations without executables #9933
Conversation
51e9059 to
a34e653
Compare
a34e653 to
c5497b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested and it all looks good. I appreciate the updates to the docs language π I've added some thoughts on how to possibly improve them further.
Co-authored-by: Tyler McGoffin <[email protected]>
Co-authored-by: Tyler McGoffin <[email protected]>
Better clarify the two extension types in the `extension install` docs. Co-authored-by: Tyler McGoffin <[email protected]>
|
It occurs to me that this is a breaking change. I wonder if there are scripts out there that do: Which will start breaking. Need to think about this. |
|
So we have two options here:
The advantage of not breaking is clear, the advantage of breaking is consistency. I'd probably favour consistency and if it breaks someone we can apologise. Happy for someone to disagree though. |
@williammartin could you talk more about why this would be breaking? Apologies if it is obvious π Are you talking about if someone had a script checking if Maybe we only send that message to stderr when there is a TTY? |
|
@BagToad my bad, I actually thought this was erroring (exit non-zero), not just a warning. I don't feel strongly either way about just the message. Maybe I'd favour just having it on TTY, since realistically, people who are running it in a script probably understand what the semantics are of the command. |
|
@williammartin, I think you're right actually. We are returning an Ideas:
|
|
I think we should continue to exit 0 in all cases. I think most uses of |
Instead of returning `ErrExtensionExecutableNotFound` error which causes `gh` to have a non-zero exit code, catch it and print the message to stderr, returning nil. Only print the warning to stderr when there is a TTY.
573283f to
e5eedef
Compare
|
Thanks @williammartin π I pushed a few commits to fix that if you could give it another review, please. I also added tests in DemoNo TTY With TTY Comments:I saw inconsistency in the way the rest of the codebase checks if we are in a TTY before printing to stderr. I saw three different approaches: 1. Check if stderr is TTY only, then print to stderr: Lines 108 to 110 in 9177b22
2. Check if stdout is TTY only, then print to stderr: cli/pkg/cmd/extension/command.go Lines 168 to 170 in 9177b22
3. Check if both stdout and stderr are TTY, then print to stderr: Line 187 in 9177b22
Lines 213 to 218 in 9177b22
With all the different options, I chose option 2 - check if stdout is TTY only, then print to stderr because there is precedent for this already in cli/pkg/cmd/extension/command.go Lines 344 to 346 in e5eedef
Let me know if you think I should have chosen a different option, please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looking really good.
Check for executable file existence using os.IsNotExist for clearer error handling
|
After some discussion we decided that the message should only be displayed when there is a TTY. Acceptance CriteriaGiven I invoke Given I invoke This should be styled when there is a TTY and unstyled when there is not. When I run LGTM |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | minor | `v2.63.2` -> `v2.64.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.64.0`](https://github.com/cli/cli/releases/tag/v2.64.0): GitHub CLI 2.64.0 [Compare Source](cli/cli@v2.63.2...v2.64.0) #### What's Changed - docs: improve docs for browse command as of [#​5352](cli/cli#5352) by [@​ankddev](https://github.com/ankddev) in cli/cli#10025 - Open MR against gh-merge-base by [@​heaths](https://github.com/heaths) in cli/cli#9712 - Add integration tests for `gh attestation verify` when the `bundle-from-oci` flag is specified by [@​malancas](https://github.com/malancas) in cli/cli#10020 - `gh repo rename` help text clarifies new repo name should not include owner by [@​BagToad](https://github.com/BagToad) in cli/cli#10044 - fix: list branches in square brackets in `gh run` and `gh codespace` by [@​uday-rana](https://github.com/uday-rana) in cli/cli#10043 - Bump actions/attest-build-provenance from 1.4.4 to 2.1.0 by [@​dependabot](https://github.com/dependabot) in cli/cli#10056 - Bump golang.org/x/crypto from 0.29.0 to 0.31.0 by [@​dependabot](https://github.com/dependabot) in cli/cli#10070 - Improve documentation and error messaging for local extension installations without executables by [@​BagToad](https://github.com/BagToad) in cli/cli#9933 - docs: better document auth scopes by [@​ankddev](https://github.com/ankddev) in cli/cli#10026 - Sigstore verifier logic updates by [@​malancas](https://github.com/malancas) in cli/cli#9999 - `gh pr merge --delete-branch` exits with error when merge requested via merge queue by [@​BagToad](https://github.com/BagToad) in cli/cli#10074 - sundry `gh at inspect` improvements by [@​phillmv](https://github.com/phillmv) in cli/cli#9954 - Support `pr view` for intra-org forks by [@​williammartin](https://github.com/williammartin) in cli/cli#10078 - Print policy information before verifying attestations by [@​malancas](https://github.com/malancas) in cli/cli#9891 - Improve error handling in apt setup script by [@​jobegrabber](https://github.com/jobegrabber) in cli/cli#10055 - Use Windows compatible file name for downloaded attestations when running `gh attestation download` by [@​malancas](https://github.com/malancas) in cli/cli#10051 - Bump github.com/cpuguy83/go-md2man/v2 from 2.0.5 to 2.0.6 by [@​dependabot](https://github.com/dependabot) in cli/cli#10094 - Perform all `gh attestation verify` policy options configuration in the `newEnforcementCriteria()` function by [@​malancas](https://github.com/malancas) in cli/cli#10012 #### New Contributors - [@​ankddev](https://github.com/ankddev) made their first contribution in cli/cli#10025 - [@​uday-rana](https://github.com/uday-rana) made their first contribution in cli/cli#10043 - [@​jobegrabber](https://github.com/jobegrabber) made their first contribution in cli/cli#10055 **Full Changelog**: cli/cli@v2.63.2...v2.64.0 </details> --- ### Configuration π **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. π **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS43Ny4wIiwidXBkYXRlZEluVmVyIjoiMzkuNzcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Fixes #9760
Requirements
Demo
Reproduction
Error message:
Cleanup/reset: