diff --git a/pkg/cmd/root/official_extension.go b/pkg/cmd/root/official_extension_stub.go similarity index 81% rename from pkg/cmd/root/official_extension.go rename to pkg/cmd/root/official_extension_stub.go index bc1f21893..2e5a69bec 100644 --- a/pkg/cmd/root/official_extension.go +++ b/pkg/cmd/root/official_extension_stub.go @@ -11,12 +11,12 @@ import ( "github.com/spf13/cobra" ) -// NewCmdOfficialExtension creates a hidden stub command for an official +// NewCmdOfficialExtensionStub creates a hidden stub command for an official // extension that has not yet been installed. When invoked, it suggests // installing the extension and, in interactive sessions, offers to do so // immediately. After a successful install, the extension is dispatched with // the original arguments. -func NewCmdOfficialExtension(io *iostreams.IOStreams, p prompter.Prompter, em extensions.ExtensionManager, ext *extensions.OfficialExtension) *cobra.Command { +func NewCmdOfficialExtensionStub(io *iostreams.IOStreams, p prompter.Prompter, em extensions.ExtensionManager, ext *extensions.OfficialExtension) *cobra.Command { cmd := &cobra.Command{ Use: ext.Name, Short: fmt.Sprintf("Install the official %s extension", ext.Name), @@ -26,7 +26,7 @@ func NewCmdOfficialExtension(io *iostreams.IOStreams, p prompter.Prompter, em ex // cobra validation errors before reaching RunE. DisableFlagParsing: true, RunE: func(cmd *cobra.Command, args []string) error { - return officialExtensionRun(io, p, em, ext, args) + return officialExtensionStubRun(io, p, em, ext, args) }, } @@ -35,7 +35,7 @@ func NewCmdOfficialExtension(io *iostreams.IOStreams, p prompter.Prompter, em ex return cmd } -func officialExtensionRun(io *iostreams.IOStreams, p prompter.Prompter, em extensions.ExtensionManager, ext *extensions.OfficialExtension, args []string) error { +func officialExtensionStubRun(io *iostreams.IOStreams, p prompter.Prompter, em extensions.ExtensionManager, ext *extensions.OfficialExtension, args []string) error { stderr := io.ErrOut if !io.CanPrompt() { diff --git a/pkg/cmd/root/official_extension_test.go b/pkg/cmd/root/official_extension_stub_test.go similarity index 94% rename from pkg/cmd/root/official_extension_test.go rename to pkg/cmd/root/official_extension_stub_test.go index 6986c4cb5..4fadd67d3 100644 --- a/pkg/cmd/root/official_extension_test.go +++ b/pkg/cmd/root/official_extension_stub_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestOfficialExtensionRun(t *testing.T) { +func TestOfficialExtensionStubRun(t *testing.T) { ext := &extensions.OfficialExtension{Name: "cool", Owner: "github", Repo: "gh-cool"} tests := []struct { @@ -101,7 +101,7 @@ func TestOfficialExtensionRun(t *testing.T) { }, } - err := officialExtensionRun(ios, p, em, ext, tt.args) + err := officialExtensionStubRun(ios, p, em, ext, tt.args) if tt.wantErr != "" { require.Error(t, err) @@ -134,13 +134,13 @@ func TestOfficialExtensionRun(t *testing.T) { } } -func TestNewCmdOfficialExtension_Properties(t *testing.T) { +func TestNewCmdOfficialExtensionStub_Properties(t *testing.T) { ios, _, _, _ := iostreams.Test() ext := &extensions.OfficialExtension{Name: "cool", Owner: "github", Repo: "gh-cool"} em := &extensions.ExtensionManagerMock{} p := &prompter.PrompterMock{} - cmd := NewCmdOfficialExtension(ios, p, em, ext) + cmd := NewCmdOfficialExtensionStub(ios, p, em, ext) assert.Equal(t, "cool", cmd.Use) assert.True(t, cmd.Hidden) diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 700ca570d..068129ba2 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -238,7 +238,7 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) (*cobra.Command, if _, _, err := cmd.Find([]string{ext.Name}); err == nil { continue } - cmd.AddCommand(NewCmdOfficialExtension(io, f.Prompter, em, ext)) + cmd.AddCommand(NewCmdOfficialExtensionStub(io, f.Prompter, em, ext)) } cmdutil.DisableAuthCheck(cmd)