Skip to content

Commit

Permalink
feat: adds basic commands
Browse files Browse the repository at this point in the history
Signed-off-by: Kasper J. Hermansen <[email protected]>
  • Loading branch information
kjuulh committed Jan 26, 2024
1 parent 4822d72 commit 9b72a7a
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
56 changes: 56 additions & 0 deletions cmd/ext.go
Original file line number Diff line number Diff line change
@@ -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
}
31 changes: 31 additions & 0 deletions internal/extensions/extensions.go
Original file line number Diff line number Diff line change
@@ -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{}

0 comments on commit 9b72a7a

Please sign in to comment.