From 3bc7b7e7e25b75fd5d6bf9b1e3b667a21c003147 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Thu, 30 Jan 2025 11:40:42 +0500 Subject: [PATCH 1/3] [gh extensions install] Improve help text and error message --- pkg/cmd/extension/command.go | 10 +++++++++- pkg/cmd/extension/manager.go | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/extension/command.go b/pkg/cmd/extension/command.go index dad4021b6..ae9a917a6 100644 --- a/pkg/cmd/extension/command.go +++ b/pkg/cmd/extension/command.go @@ -298,9 +298,17 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command { Long: heredoc.Docf(` Install a GitHub CLI extension from a GitHub or local repository. - For GitHub repositories, the repository argument can be specified in %[1]sOWNER/REPO%[1]s format or as a full repository URL. + For GitHub repositories, the repository argument can be specified in + %[1]sOWNER/REPO%[1]s format or as a full repository URL. The URL format is useful when the repository is not hosted on github.com. + For remote repositories, the GitHub CLI first looks for the release artifacts assuming + that it's a binary extension i.e. prebuilt binaries provided as part of the release. + In the absence of a release, the repository itself is cloned assuming that it's a + script extension i.e. prebuilt executable or script exists on its root. + The %[1]s--pin%[1]s flag may be used to specify a tag or commit for binary and script + extensions respectively, the latest one is used otherwise. + For local repositories, often used while developing extensions, use %[1]s.%[1]s as the value of the repository argument. Note the following: diff --git a/pkg/cmd/extension/manager.go b/pkg/cmd/extension/manager.go index c6947f479..e83a3ed22 100644 --- a/pkg/cmd/extension/manager.go +++ b/pkg/cmd/extension/manager.go @@ -268,7 +268,7 @@ func (m *Manager) Install(repo ghrepo.Interface, target string) error { return err } if !hs { - return errors.New("extension is not installable: missing executable") + return fmt.Errorf("extension is not installable: no acceptable release artifact or script found in %s", repo) } return m.installGit(repo, target) From 91c75596ee19b13fd9dea799388b80b30d5a7db0 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Wed, 5 Feb 2025 12:14:39 +0500 Subject: [PATCH 2/3] Address review comments --- pkg/cmd/extension/command.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/extension/command.go b/pkg/cmd/extension/command.go index ae9a917a6..93c385374 100644 --- a/pkg/cmd/extension/command.go +++ b/pkg/cmd/extension/command.go @@ -306,8 +306,9 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command { that it's a binary extension i.e. prebuilt binaries provided as part of the release. In the absence of a release, the repository itself is cloned assuming that it's a script extension i.e. prebuilt executable or script exists on its root. + The %[1]s--pin%[1]s flag may be used to specify a tag or commit for binary and script - extensions respectively, the latest one is used otherwise. + extensions respectively, the latest version is used otherwise. For local repositories, often used while developing extensions, use %[1]s.%[1]s as the value of the repository argument. Note the following: From 50e7b00327520ffdbce9f637f54f3d3f1188c344 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Wed, 5 Feb 2025 12:21:29 +0500 Subject: [PATCH 3/3] Address review comments --- pkg/cmd/extension/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/extension/manager.go b/pkg/cmd/extension/manager.go index e83a3ed22..b7f1f1c0c 100644 --- a/pkg/cmd/extension/manager.go +++ b/pkg/cmd/extension/manager.go @@ -268,7 +268,7 @@ func (m *Manager) Install(repo ghrepo.Interface, target string) error { return err } if !hs { - return fmt.Errorf("extension is not installable: no acceptable release artifact or script found in %s", repo) + return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", repo) } return m.installGit(repo, target)