Rename official extension files and types to stubs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Kynan Ware 2026-04-16 10:34:48 -06:00
parent 1d59334964
commit b8d504cbd9
3 changed files with 9 additions and 9 deletions

View file

@ -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() {

View file

@ -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)

View file

@ -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)