Commit graph

189 commits

Author SHA1 Message Date
William Martin
46862f96d9 Reformat ext install long 2024-12-12 14:57:34 +01:00
Kynan Ware
32abca8c38 Mention Windows quirk in ext install help text 2024-12-12 06:42:34 -07:00
Kynan Ware
3b93e28910 Fix error mishandling in local ext install 2024-12-12 06:40:37 -07:00
Kynan Ware
ec4b2dfe1b Assert on err msg directly in ext install tests 2024-12-12 06:38:04 -07:00
Kynan Ware
b9b60637b9 Clarify hosts in ext install help text 2024-12-12 06:35:13 -07:00
Kynan Ware
b2ab7b84f8 Refactor extension executable error handling 2024-12-08 15:55:09 -07:00
bagtoad
b5f3463b75 Improve error handling for missing executable
Check for executable file existence using os.IsNotExist for clearer error handling
2024-11-20 16:03:03 -07:00
bagtoad
e5eedefd09 Assert stderr is empty in manager_test.go 2024-11-19 16:42:16 -07:00
bagtoad
83c5bf3589 Update error message wording 2024-11-19 16:42:15 -07:00
bagtoad
4b73e55fd2 Change: exit zero, still print warning to stderr
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.
2024-11-19 16:42:15 -07:00
Kynan Ware
1bc2bb8059
Improve docs on installing extensions
Better clarify the two extension types in the `extension install` docs.

Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-11-18 16:45:57 -07:00
Kynan Ware
bb3b64ad06
Update language for missing extension executable
Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-11-18 16:25:07 -07:00
Kynan Ware
2ec27ff9fe
Update test comments about Windows behavior
Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-11-18 16:21:14 -07:00
bagtoad
c5497b4d28 Document requirements for local extensions 2024-11-17 21:01:49 -07:00
bagtoad
b575fe8ebc Warn when installing local ext with no executable 2024-11-17 21:01:49 -07:00
bagtoad
daec7a0e0e Check extOwner for no value instead 2024-10-21 13:28:37 -06:00
bagtoad
35aa8521c4 Fix tests for invalid extension name 2024-10-21 12:47:14 -06:00
bagtoad
cc32f33583 Refactor to remove code duplication 2024-10-21 12:37:27 -06:00
bagtoad
6923fb5cc8 add validation for local ext install 2024-10-20 16:37:40 -06:00
Tim Rogers
1eda1b41a7
Emit a log message when extension installation falls back to a darwin-amd64 binary on an Apple Silicon macOS machine 2024-09-21 14:56:43 -05:00
Tim Rogers
665e41566f
Fix test 2024-09-18 19:07:32 +01:00
Tim Rogers
195188cee8
Update pkg/cmd/extension/manager.go
Co-authored-by: Tyler McGoffin <jtmcg@github.com>
2024-09-18 18:55:20 +01:00
Tim Rogers
81d57a0643 Improve error presentation 2024-09-18 14:00:36 +01:00
Tim Rogers
dded039125 Improve the suggested command for creating an issue when an extension doesn't have a binary for your platform
When installing an extension, the CLI must to select the correct
binary to download for the machine (see the
[`installBin` function](78c1d00ecc/pkg/cmd/extension/manager.go (L240))).

By default, the CLI will download a binary matching the current
machine's architecture.

If a suitable binary isn't available, the CLI
[outputs an error](78c1d00ecc/pkg/cmd/extension/manager.go (L278)),
directing the user to create an issue on the extension's
repository:

```go
if asset == nil {
	return fmt.Errorf(
		"%[1]s unsupported for %[2]s. Open an issue: `gh issue create -R %[3]s/%[1]s -t'Support %[2]s'`",
		repo.RepoName(), platform, repo.RepoOwner())
}
```

The issue this creates isn't very clear or helpful. It isn't
obvious where it is coming from, or what you need to do.

This improves the suggested command, adding a better title
to the issue and an explanatory body.

To test this, try installing my
`timrogers/gh-extension-without-binary` extension, which only has
an esoteric `linux-ppc64` binary 😸:

```bash
gh extension install timrogers/gh-extension-without-binary
```

You'll get a nice output like this:

```
gh-extension-without-binary unsupported for darwin-arm64. Open an issue: `gh issue create -R timrogers/gh-extension-without-binary --title "Add support for the darwin-arm64 architecture" --body "This extension does not support the darwin-arm64 architecture. I tried to install it on a darwin-arm64 machine, and it failed due to the lack of an available binary. Would you be able to update the extension's build and release process to include the relevant binary? For more details, see <https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions>."`
```

...which produces an issue like
https://github.com/timrogers/gh-extension-without-binary/issues/4.

I have tested the resulting command on macOS and Windows, so
I am confident that it has *at least reasonable* cross-platform
support.

Fixes https://github.com/cli/cli/issues/9600.
2024-09-18 14:00:36 +01:00
William Martin
99b789e745 Add test for extension install fallback to amd64 on darwin 2024-09-13 11:59:54 +02:00
William Martin
e0fb793b44 Stub hasRosetta for tests 2024-09-12 13:56:19 -06:00
Tim Rogers
5296d60832
Refactor conditions
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-09-12 18:53:24 +01:00
Tim Rogers
a0a2567354
Suggest installing Rosetta when extension installation fails due to missing darwin-arm64 binary, but a darwin-amd64 binary is available
When installing an extension, the CLI must to select the correct
binary to download for the machine (see the
[`installBin` function](78c1d00ecc/pkg/cmd/extension/manager.go (L240))).

By default, the CLI will download a binary matching the current
machine's architecture.

However, to provide better support for Macs running on Apple
Silicon, it will
[fall back](78c1d00ecc/pkg/cmd/extension/manager.go (L267-L274))
from `darwin-arm64` to `darwin-amd64` if
[Rosetta](https://support.apple.com/en-gb/102527) (Apple's
compatibility layer) is installed.

If Rosetta isn't installed, this fallback doesn't happen, which
can lead to surprising and confusing results when one Mac has
Rosetta and another doesn't, because the extension will install
on one machine but not another.

In the situation where a `darwin-arm64` binary isn't available
but the CLI can't fall back to `amd64` because Rosetta isn't
installed, this updates our error message to suggest installing
Rosetta.

Closes https://github.com/cli/cli/issues/9592.
2024-09-11 11:50:05 +01:00
Kynan Ware
5b7070f027
include required permissions to generate attestations 2024-08-14 15:16:45 -06:00
Kynan Ware
820f4f3469
Do not generate build attestations for otherBinWorkflow.yml 2024-08-14 12:02:11 -06:00
bagtoad
025dcc8e95 Use latest checkout version, generate attestations, and specify go version file input. 2024-08-14 10:20:41 -06:00
leevic31
222d6c8e65 Removed unused param flagDryRun from upgradeFunc 2024-05-16 15:41:47 -04:00
leevic31
e3d5c063ef Added summary TTY message to tests 2024-05-16 15:38:49 -04:00
leevic31
1dfcaab102 Added TTY message to summarize checking extension upgrades 2024-05-16 15:31:56 -04:00
leevic31
a6c0d3b0b3 removed tty message 2024-05-15 15:29:12 -04:00
William Martin
07e0ff7127 Fix repo fork to use remote protocol if none configured 2024-05-10 10:48:36 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Zach Steindler
6eb650185b
Add progress indicator when installing an extension (#8411) 2023-12-04 19:52:11 +00:00
Andy Feller
b77de0d458 Additional formatting changes
- gh help actions
  - highlight 3 commands to run for more information
- gh extension
  - wrapping url for online linking
  - fix install subcommand missing backtick formatting
- gh release create
  - fixing mixed indenting causing usage misalignment
- root help
  - backtick wrap help command for more info for consistency
- gh help environment
  - backtick wrap missed OWNER/REPO
- gh variable
  - brought consistency to output when deleting or setting variable
2023-12-01 09:08:51 -05:00
Yukai Chou
afbdb945bc Small docs tweaks 2023-11-23 07:14:38 +08:00
Yukai Chou
07a87ca8a4 Wrap special values and placeholders like - and $1 2023-11-23 07:09:29 +08:00
Yukai Chou
21bf1babdf Proof-reading 2023-11-17 02:04:35 +08:00
Yukai Chou
b70c28ba20 Misc docs improvements 2023-11-17 01:32:28 +08:00
Yukai Chou
896101678f Wrap cli commands in backticks uniformly 2023-11-17 01:32:00 +08:00
Yukai Chou
17d336e005 Wrap cli flags in backticks uniformly 2023-11-16 22:54:27 +08:00
Sam Coe
7924878315
Fix git protocol and refactor Config interface (#8246) 2023-10-27 15:42:05 +02:00
Heath Stewart
7738b6187c
Add headers to all tables (#8157) 2023-10-20 11:20:02 +02:00
Swastik Baranwal
6696229fb1
gh extension install not give an error if extension already installed and a clear message (#8211)
* `gh extension install` not give an error if extension already installed and a clear message

* remove test

* Add implementation

* lint go.sum

---------

Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
2023-10-19 15:22:21 +02:00
Mislav Marohnić
beb6234f96
Speed up listing extensions by lazy-loading extension information when needed (#7493) 2023-06-14 09:33:18 +09:00
Sam Coe
fac497108b
Set upstream remote to track all branches after initial fetch (#7542) 2023-06-12 09:23:56 +09:00