From 8f046e0b77c51bd9c76fe6460dc7478ddf554c10 Mon Sep 17 00:00:00 2001 From: Roshan Padaki Date: Wed, 13 Apr 2022 03:31:24 -0400 Subject: [PATCH] `gh extensions list`: Don't error if no extensions installed (#5445) --- pkg/cmd/extension/command.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/extension/command.go b/pkg/cmd/extension/command.go index f61ea689d..f56af4483 100644 --- a/pkg/cmd/extension/command.go +++ b/pkg/cmd/extension/command.go @@ -47,7 +47,9 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { cmds := m.List() if len(cmds) == 0 { - return errors.New("no extensions installed") + cs := io.ColorScheme() + fmt.Fprintf(io.ErrOut, "%s No installed extensions found\n", cs.WarningIcon()) + return nil } cs := io.ColorScheme() t := utils.NewTablePrinter(io) @@ -80,10 +82,10 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command { Short: "Install a gh extension from a repository", Long: heredoc.Doc(` Install a GitHub repository locally as a GitHub CLI extension. - + The repository argument can be specified in "owner/repo" format as well as a full URL. The URL format is useful when the repository is not hosted on github.com. - + To install an extension in development from the current directory, use "." as the value of the repository argument.