Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add shuttle extensions cli commands #220

Open
wants to merge 4 commits into
base: feat/shuttle-extensions
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
59 changes: 59 additions & 0 deletions cmd/ext.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package cmd

import (
"github.com/lunarway/shuttle/internal/extensions"
"github.com/spf13/cobra"
)

func newExtCmd() *cobra.Command {
extManager := extensions.NewExtensionsManager("some registry")
kjuulh marked this conversation as resolved.
Show resolved Hide resolved

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",
Long: "Install ensures that extensions already known about are downloaded and available",
kjuulh marked this conversation as resolved.
Show resolved Hide resolved
RunE: func(cmd *cobra.Command, args []string) error {
return nil
},
}

return cmd
}

func newExtUpdateCmd(extManager *extensions.ExtensionsManager) *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Long: "Update will fetch the latest version of the extensions from the given registry",
RunE: func(cmd *cobra.Command, args []string) error {
return nil
},
}

return cmd
}

func newExtInitCmd(extManager *extensions.ExtensionsManager) *cobra.Command {
cmd := &cobra.Command{
Use: "init",
Long: "init will create an initial extensions repository",
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{}
Loading