Commit graph

93 commits

Author SHA1 Message Date
Copilot
ff8873da07
Fix extension install error message showing raw struct instead of owner/repo (#12836)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: williammartin <1611510+williammartin@users.noreply.github.com>
2026-03-05 12:28:54 +01:00
Azeem Sajid
50e7b00327 Address review comments 2025-02-05 12:21:29 +05:00
Azeem Sajid
3bc7b7e7e2 [gh extensions install] Improve help text and error message 2025-01-30 11:40:42 +05:00
Andy Feller
41e99b9eab
Merge pull request #9934 from cli/andyfeller/cli-cli-8183-timeout-pt2
Ensure extension update notices only notify once within 24 hours, provide ability to disable all extension update notices
2025-01-13 09:12:32 -05:00
Andy Feller
0a1c9be656 Expand docs on cleaning extension update dir
This summarizes a conversation within cli/cli#9934 PR regarding how the new extension update directory metadata would affect gh if not cleaned up.
2025-01-10 14:57:10 -05:00
Andy Feller
97eb8a194e Simplifying cleanExtensionUpdateDir logic
This function was doing some unnecessary heavy lifting detecting if the directory being deleted actually existed when `os.RemoveAll()` would handle directories that exist or not.
2025-01-10 14:29:55 -05:00
nobe4
69b17272d6
fix: add back colon that I removed 2025-01-10 17:17:14 +01:00
nobe4
69ab0c9c85
fix: actually read how MaxFunc work and simplify the code 2025-01-10 16:31:13 +01:00
nobe4
1899b83509
fix: padded display
Apply code suggestion from @andyfeller from:
- https://github.com/cli/cli/pull/10194#discussion_r1909761552
- https://github.com/cli/cli/pull/10194#discussion_r1909764278
2025-01-10 16:28:50 +01:00
William Martin
889c4c75f3 Collapse dryrun checks in ext bin upgrade 2025-01-10 16:06:01 +01:00
nobe4
3b69ea6fbc
feat: make the extension upgrade fancier
This left-pad the extension names during upgrade so they all align
nicely. It makes easier to see what is happening.
2025-01-07 12:01:02 +01:00
Andy Feller
5ad6ccf73a Merge branch 'trunk' into andyfeller/cli-cli-8183-timeout-pt2 2024-12-13 22:53:13 -05:00
Andy Feller
c12e3694e8 Implement partial feedback before trunk update 2024-12-13 22:52:03 -05:00
Kynan Ware
3b93e28910 Fix error mishandling in local ext install 2024-12-12 06:40:37 -07:00
Andrew Feller
a55f50b115 Remove Extension.FullName() from interface
- this was something I did in the original implementation of this improved extension update notification logic
- discovering other parts of the extension manager code that were working with non-prefixed extension names motivated a different approach
- the extension manager code that requires the extension be prefixed has been enhanced to use the centralized ensurePrefixed() logic, making the need for this on the extension unnecessary
2024-12-08 20:01:26 -05:00
Andrew Feller
97630fe73c Enhance extension manager and tests
- extension manager has been made responsible for extension update directory information
- extension manager has been enhanced to ensure that previously left extension update metadata is deleted before installing an extension
- extension manager has been enhanced to ensure that extension update metadata is deleted when extension is being removed
- refactored extension command tests for manager change, ensuring previous and expected states along with returned release info
- refactored extension manager tests for ensuring previous extension update entries are removed before installing extension
- created extension manager test for installing local extension
- centralized logic for checking and ensuring extension name is "gh-" prefixed
2024-12-08 19:40:24 -05: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
83c5bf3589 Update error message wording 2024-11-19 16:42:15 -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
bagtoad
b575fe8ebc Warn when installing local ext with no executable 2024-11-17 21:01:49 -07: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
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
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
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
Sam Coe
7924878315
Fix git protocol and refactor Config interface (#8246) 2023-10-27 15:42:05 +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
39805fa9b1
Properly handle closing files that have been writen to (#7199) 2023-03-23 01:17:47 +00:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
vilmibm
fec1f115b0 remove unused args from installGit 2023-01-26 16:05:41 -08:00
Ariel Deitcher
a231b4aded
extension create: make initial commit (#6833) 2023-01-24 17:48:56 +01:00
Des Preston
23913ac371
Show version diff when updating a single extension (#6647) 2022-12-08 14:40:41 +00:00
Sam Coe
6bbfc5056d
Use git client in extension manager (#6547) 2022-11-10 11:38:12 +02:00
Ariel Deitcher
33e589465e
--force overrides pinned extensions (#6513) 2022-11-03 12:12:20 +01:00
Sam Coe
4294ee14a1
revert revert 57fbe4f317 (#6474) 2022-10-20 12:17:20 +00:00
Sam Coe
2cefb9fa59
Fix pr create regression (#6472)
* Revert "Refactor to use new git client (#6447)"

This reverts commit 57fbe4f317.

* Fix pr create regression
2022-10-20 12:46:23 +03:00
Sam Coe
57fbe4f317
Refactor to use new git client (#6447) 2022-10-19 21:11:36 +03:00
Ariel Deitcher
abb8c86ee8
mntly/extension not found (#6425)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-10-14 15:27:15 +02:00
casswedson
00bc550dc6 chore: typo hunting ft. codespell 2022-07-09 21:41:09 -05:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Alexandre Zollinger Chohfi
d1a0f72cd8 Added Arm64 compilation 2022-05-25 16:47:50 -07:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Mislav Marohnić
ae0b93575e Add support for installing binary extensions on M1 Macs
If the extension publishes an amd64 binary and Rosetta is available,
use that binary as it will most likely work.

If the extension publishes an arm64 binary, make sure to codesign it
after downloading so that the OS allows its execution.
2022-04-13 20:01:18 +02:00
Sam Coe
2c0236d096
Add extension upgrade --dry-run (#5098) 2022-04-12 07:18:08 +00:00
meiji163
65bc3acaa5 merge upstream 2022-03-07 17:58:48 -08:00