Commit graph

170 commits

Author SHA1 Message Date
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
Mislav Marohnić
cb93db2b22
fix tests 2023-06-09 17:56:51 +02:00
Mislav Marohnić
3a33b6e5a5
fix test 2023-06-09 17:46:13 +02:00
Sam Coe
74ee8cacae
Allow creating of nested aliases (#7457) 2023-05-25 09:46:45 +09:00
Alexander Seiler
218f29f296
Correct some typos 2023-04-21 03:51:31 +02:00
Sam Coe
dbc2f05124
Update go-gh to v2 (#7299)
* Update go-gh

* Update code for go-gh v2
2023-04-16 15:34:23 +10:00
Kousik Mitra
7ee35e43cc
Enable owner flag to take multiple values for searching 2023-04-12 10:37:09 +05:30
Sam Coe
39805fa9b1
Properly handle closing files that have been writen to (#7199) 2023-03-23 01:17:47 +00:00
Heath Stewart
88cae9f5be
Support ext install --force (#7173)
Resolves #7096
2023-03-20 15:58:30 +01:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
vilmibm
b8a6c1daa7 include readme viewing in small help 2023-02-02 13:15:10 -08:00
vilmibm
c9590f36d9 longer small help 2023-02-02 12:18:13 -08:00
vilmibm
300bc2cb69 fix tests 2023-01-31 14:42:34 -08:00
vilmibm
37eee30411 WIP fixing tests 2023-01-31 12:06:32 -08:00
vilmibm
3ab72f44d3 WIP: fixing tests 2023-01-26 16:40:54 -08:00
vilmibm
ba725d7af2 update doc 2023-01-26 16:38:30 -08:00
vilmibm
3af8e56c07 TODOs 2023-01-26 16:33:14 -08:00
vilmibm
f60970ffa9 clean up command screen 2023-01-26 16:32:22 -08:00
vilmibm
c2c4d8c3f8 fix silencing git output 2023-01-26 16:08:08 -08:00
vilmibm
fec1f115b0 remove unused args from installGit 2023-01-26 16:05:41 -08:00