diff --git a/cmd/command/plural/plural.go b/cmd/command/plural/plural.go index 948814fce..5fe0eed64 100644 --- a/cmd/command/plural/plural.go +++ b/cmd/command/plural/plural.go @@ -26,7 +26,6 @@ import ( "github.com/pluralsh/plural-cli/cmd/command/proxy" "github.com/pluralsh/plural-cli/cmd/command/push" "github.com/pluralsh/plural-cli/cmd/command/repo" - "github.com/pluralsh/plural-cli/cmd/command/stack" "github.com/pluralsh/plural-cli/cmd/command/up" "github.com/pluralsh/plural-cli/cmd/command/upgrade" "github.com/pluralsh/plural-cli/cmd/command/version" @@ -244,7 +243,6 @@ func CreateNewApp(plural *Plural) *cli.App { push.Command(plural.Plural), repo.Command(plural.Plural), repo.APICommand(plural.Plural), - stack.Command(plural.Plural), log.Command(plural.Plural), info.Command(plural.Plural), cmdinit.Command(plural.Plural), diff --git a/cmd/command/stack/stacks.go b/cmd/command/stack/stacks.go deleted file mode 100644 index 99c80727d..000000000 --- a/cmd/command/stack/stacks.go +++ /dev/null @@ -1,84 +0,0 @@ -package stack - -import ( - "fmt" - - "github.com/pluralsh/plural-cli/pkg/client" - "github.com/pluralsh/plural-cli/pkg/common" - - "github.com/urfave/cli" - - "github.com/pluralsh/plural-cli/pkg/api" - "github.com/pluralsh/plural-cli/pkg/bundle" - "github.com/pluralsh/plural-cli/pkg/manifest" - "github.com/pluralsh/plural-cli/pkg/utils" -) - -type Plural struct { - client.Plural -} - -func Command(clients client.Plural) cli.Command { - p := Plural{ - Plural: clients, - } - return cli.Command{ - Name: "stack", - Usage: "Commands for installing and discovering plural stacks", - Subcommands: p.stackCommands(), - } -} - -func (p *Plural) stackCommands() []cli.Command { - return []cli.Command{ - { - Name: "install", - Usage: "installs a plural stack for your current provider", - ArgsUsage: "{stack-name}", - Flags: []cli.Flag{ - cli.BoolFlag{ - Name: "refresh", - Usage: "re-enter the configuration for all bundles", - }, - }, - Action: common.Tracked(common.LatestVersion(common.Rooted(common.RequireArgs(p.stackInstall, []string{"{stack-name}"}))), "stack.install"), - }, - { - Name: "list", - Usage: "lists stacks to potentially install", - Flags: []cli.Flag{ - cli.BoolTFlag{ - Name: "account", - Usage: "only list stacks within your account", - }, - }, - Action: common.LatestVersion(common.Rooted(p.stackList)), - }, - } -} - -func (p *Plural) stackInstall(c *cli.Context) (err error) { - name := c.Args().Get(0) - man, err := manifest.FetchProject() - if err != nil { - return - } - - p.InitPluralClient() - err = bundle.Stack(p.Client, name, man.Provider, c.Bool("refresh")) - utils.Note("To edit the configuration you've just entered, edit the context.yaml file at the root of your repo, or run with the --refresh flag\n") - return -} - -func (p *Plural) stackList(c *cli.Context) (err error) { - p.InitPluralClient() - stacks, err := p.ListStacks(c.Bool("account")) - if err != nil { - return api.GetErrorResponse(err, "ListStacks") - } - - headers := []string{"Name", "Description", "Featured"} - return utils.PrintTable(stacks, headers, func(s *api.Stack) ([]string, error) { - return []string{s.Name, s.Description, fmt.Sprintf("%v", s.Featured)}, nil - }) -} diff --git a/pkg/bundle/stack.go b/pkg/bundle/stack.go deleted file mode 100644 index 7bb148399..000000000 --- a/pkg/bundle/stack.go +++ /dev/null @@ -1,37 +0,0 @@ -package bundle - -import ( - "fmt" - "strings" - - "github.com/pluralsh/plural-cli/pkg/api" - "github.com/pluralsh/plural-cli/pkg/utils" -) - -func Stack(client api.Client, name, provider string, refresh bool) error { - s, err := client.GetStack(name, provider) - if err != nil { - return api.GetErrorResponse(err, "GetStack") - } - - utils.Highlight("You're attempting to install stack: %s\n>> ", s.Name) - fmt.Println(s.Description) - fmt.Println() - - repos := make([]string, 0) - for _, r := range s.Bundles { - repos = append(repos, r.Repository.Name) - } - - if !utils.Confirm(fmt.Sprintf("This will install all of {%s}, do you want to proceed?", strings.Join(repos, ", "))) { - return nil - } - - for _, recipe := range s.Bundles { - if err := doInstall(client, recipe, recipe.Repository.Name, provider, refresh); err != nil { - return err - } - } - - return nil -}