diff --git a/cmd/cmd.go b/cmd/cmd.go index bb0868d..f7092bd 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -159,6 +159,8 @@ func initializedRootFromArgs(stdout, stderr io.Writer, args []string) (*cobra.Co // Run and LS will not get closured variables from contextProvider rootCmd.ParseFlags(args) + rootCmd.AddCommand(newExtCmd()) + if isInRepoContext() { runCmd, err := newRun(uii, ctxProvider) if err != nil { diff --git a/cmd/ext.go b/cmd/ext.go new file mode 100644 index 0000000..4206495 --- /dev/null +++ b/cmd/ext.go @@ -0,0 +1,56 @@ +package cmd + +import ( + "github.com/lunarway/shuttle/internal/extensions" + "github.com/spf13/cobra" +) + +func newExtCmd() *cobra.Command { + extManager := extensions.NewExtensionsManager("some registry") + + cmd := &cobra.Command{ + Use: "ext", + Long: "helps you manage shuttle extensions", + } + + cmd.AddCommand( + newExtInstallCmd(extManager), + newExtUpdateCmd(extManager), + newExtInitCmd(extManager), + ) + + return cmd +} + +func newExtInstallCmd(extManager *extensions.ExtensionsManager) *cobra.Command { + cmd := &cobra.Command{ + Use: "install", + RunE: func(cmd *cobra.Command, args []string) error { + return nil + }, + } + + return cmd +} + +func newExtUpdateCmd(extManager *extensions.ExtensionsManager) *cobra.Command { + cmd := &cobra.Command{ + Use: "update", + RunE: func(cmd *cobra.Command, args []string) error { + return nil + }, + } + + return cmd +} + +func newExtInitCmd(extManager *extensions.ExtensionsManager) *cobra.Command { + cmd := &cobra.Command{ + Use: "init", + RunE: func(cmd *cobra.Command, args []string) error { + return nil + }, + } + + return cmd +} diff --git a/internal/extensions/extensions.go b/internal/extensions/extensions.go new file mode 100644 index 0000000..c4872d5 --- /dev/null +++ b/internal/extensions/extensions.go @@ -0,0 +1,31 @@ +package extensions + +import "context" + +type ExtensionsManager struct { + registry string +} + +func NewExtensionsManager(registry string) *ExtensionsManager { + return &ExtensionsManager{ + registry: registry, + } +} + +func (e *ExtensionsManager) Init(ctx context.Context) error { + return nil +} + +func (e *ExtensionsManager) GetAll(ctx context.Context) ([]Extension, error) { + return nil, nil +} + +func (e *ExtensionsManager) Install(ctx context.Context) error { + return nil +} + +func (e *ExtensionsManager) Update(ctx context.Context) error { + return nil +} + +type Extension struct{}