From bf9c49eccd7e174264db1c243bf9e902f0fecd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 11 Aug 2021 22:22:39 +0200 Subject: [PATCH] =?UTF-8?q?Rename=20`gh=20extensions`=20=E2=86=92=20`gh=20?= =?UTF-8?q?extension`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is for compatibility with other core commands which are all singular. --- pkg/cmd/{extensions => extension}/command.go | 7 ++++--- pkg/cmd/{extensions => extension}/command_test.go | 6 +++--- pkg/cmd/{extensions => extension}/extension.go | 2 +- pkg/cmd/{extensions => extension}/manager.go | 2 +- pkg/cmd/{extensions => extension}/manager_test.go | 2 +- pkg/cmd/{extensions => extension}/symlink_other.go | 2 +- pkg/cmd/{extensions => extension}/symlink_windows.go | 2 +- pkg/cmd/factory/default.go | 4 ++-- pkg/cmd/root/root.go | 4 ++-- 9 files changed, 16 insertions(+), 15 deletions(-) rename pkg/cmd/{extensions => extension}/command.go (97%) rename pkg/cmd/{extensions => extension}/command_test.go (98%) rename pkg/cmd/{extensions => extension}/extension.go (96%) rename pkg/cmd/{extensions => extension}/manager.go (99%) rename pkg/cmd/{extensions => extension}/manager_test.go (99%) rename pkg/cmd/{extensions => extension}/symlink_other.go (86%) rename pkg/cmd/{extensions => extension}/symlink_windows.go (95%) diff --git a/pkg/cmd/extensions/command.go b/pkg/cmd/extension/command.go similarity index 97% rename from pkg/cmd/extensions/command.go rename to pkg/cmd/extension/command.go index 9ea8a739b..26e7afba9 100644 --- a/pkg/cmd/extensions/command.go +++ b/pkg/cmd/extension/command.go @@ -1,4 +1,4 @@ -package extensions +package extension import ( "errors" @@ -15,12 +15,12 @@ import ( "github.com/spf13/cobra" ) -func NewCmdExtensions(f *cmdutil.Factory) *cobra.Command { +func NewCmdExtension(f *cmdutil.Factory) *cobra.Command { m := f.ExtensionManager io := f.IOStreams extCmd := cobra.Command{ - Use: "extensions", + Use: "extension", Short: "Manage gh extensions", Long: heredoc.Docf(` GitHub CLI extensions are repositories that provide additional gh commands. @@ -31,6 +31,7 @@ func NewCmdExtensions(f *cmdutil.Factory) *cobra.Command { An extension cannot override any of the core gh commands. `, "`"), + Aliases: []string{"extensions"}, } extCmd.AddCommand( diff --git a/pkg/cmd/extensions/command_test.go b/pkg/cmd/extension/command_test.go similarity index 98% rename from pkg/cmd/extensions/command_test.go rename to pkg/cmd/extension/command_test.go index 3611ae0ea..d934e45c6 100644 --- a/pkg/cmd/extensions/command_test.go +++ b/pkg/cmd/extension/command_test.go @@ -1,4 +1,4 @@ -package extensions +package extension import ( "io" @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestNewCmdExtensions(t *testing.T) { +func TestNewCmdExtension(t *testing.T) { tempDir := t.TempDir() oldWd, _ := os.Getwd() assert.NoError(t, os.Chdir(tempDir)) @@ -183,7 +183,7 @@ func TestNewCmdExtensions(t *testing.T) { ExtensionManager: em, } - cmd := NewCmdExtensions(&f) + cmd := NewCmdExtension(&f) cmd.SetArgs(tt.args) cmd.SetOut(ioutil.Discard) cmd.SetErr(ioutil.Discard) diff --git a/pkg/cmd/extensions/extension.go b/pkg/cmd/extension/extension.go similarity index 96% rename from pkg/cmd/extensions/extension.go rename to pkg/cmd/extension/extension.go index c9f39fd49..502522efa 100644 --- a/pkg/cmd/extensions/extension.go +++ b/pkg/cmd/extension/extension.go @@ -1,4 +1,4 @@ -package extensions +package extension import ( "path/filepath" diff --git a/pkg/cmd/extensions/manager.go b/pkg/cmd/extension/manager.go similarity index 99% rename from pkg/cmd/extensions/manager.go rename to pkg/cmd/extension/manager.go index 9d25b6510..e6fb8b751 100644 --- a/pkg/cmd/extensions/manager.go +++ b/pkg/cmd/extension/manager.go @@ -1,4 +1,4 @@ -package extensions +package extension import ( "bytes" diff --git a/pkg/cmd/extensions/manager_test.go b/pkg/cmd/extension/manager_test.go similarity index 99% rename from pkg/cmd/extensions/manager_test.go rename to pkg/cmd/extension/manager_test.go index 454479030..a5e335636 100644 --- a/pkg/cmd/extensions/manager_test.go +++ b/pkg/cmd/extension/manager_test.go @@ -1,4 +1,4 @@ -package extensions +package extension import ( "bytes" diff --git a/pkg/cmd/extensions/symlink_other.go b/pkg/cmd/extension/symlink_other.go similarity index 86% rename from pkg/cmd/extensions/symlink_other.go rename to pkg/cmd/extension/symlink_other.go index f568c17f6..f426d031c 100644 --- a/pkg/cmd/extensions/symlink_other.go +++ b/pkg/cmd/extension/symlink_other.go @@ -1,6 +1,6 @@ // +build !windows -package extensions +package extension import "os" diff --git a/pkg/cmd/extensions/symlink_windows.go b/pkg/cmd/extension/symlink_windows.go similarity index 95% rename from pkg/cmd/extensions/symlink_windows.go rename to pkg/cmd/extension/symlink_windows.go index adfb0aa6c..5f29e3fb1 100644 --- a/pkg/cmd/extensions/symlink_windows.go +++ b/pkg/cmd/extension/symlink_windows.go @@ -1,4 +1,4 @@ -package extensions +package extension import "os" diff --git a/pkg/cmd/factory/default.go b/pkg/cmd/factory/default.go index 32187689b..a6956faad 100644 --- a/pkg/cmd/factory/default.go +++ b/pkg/cmd/factory/default.go @@ -11,7 +11,7 @@ import ( "github.com/cli/cli/git" "github.com/cli/cli/internal/config" "github.com/cli/cli/internal/ghrepo" - "github.com/cli/cli/pkg/cmd/extensions" + "github.com/cli/cli/pkg/cmd/extension" "github.com/cli/cli/pkg/cmdutil" "github.com/cli/cli/pkg/iostreams" ) @@ -22,7 +22,7 @@ func New(appVersion string) *cmdutil.Factory { Branch: branchFunc(), // No factory dependencies Executable: executable(), // No factory dependencies - ExtensionManager: extensions.NewManager(), + ExtensionManager: extension.NewManager(), } f.IOStreams = ioStreams(f) // Depends on Config diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 158bb112d..acab8bc6b 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -11,7 +11,7 @@ import ( browseCmd "github.com/cli/cli/pkg/cmd/browse" completionCmd "github.com/cli/cli/pkg/cmd/completion" configCmd "github.com/cli/cli/pkg/cmd/config" - extensionsCmd "github.com/cli/cli/pkg/cmd/extensions" + extensionCmd "github.com/cli/cli/pkg/cmd/extension" "github.com/cli/cli/pkg/cmd/factory" gistCmd "github.com/cli/cli/pkg/cmd/gist" issueCmd "github.com/cli/cli/pkg/cmd/issue" @@ -75,7 +75,7 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command { cmd.AddCommand(creditsCmd.NewCmdCredits(f, nil)) cmd.AddCommand(gistCmd.NewCmdGist(f)) cmd.AddCommand(completionCmd.NewCmdCompletion(f.IOStreams)) - cmd.AddCommand(extensionsCmd.NewCmdExtensions(f)) + cmd.AddCommand(extensionCmd.NewCmdExtension(f)) cmd.AddCommand(secretCmd.NewCmdSecret(f)) cmd.AddCommand(sshKeyCmd.NewCmdSSHKey(f))