diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go deleted file mode 100644 index 750bd1f6c..000000000 --- a/cmd/helm/delete.go +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "errors" - - "github.com/codegangsta/cli" - "github.com/kubernetes/helm/pkg/format" -) - -func init() { - addCommands(deleteCmd()) -} - -func deleteCmd() cli.Command { - return cli.Command{ - Name: "delete", - Usage: "Deletes the supplied deployment", - ArgsUsage: "DEPLOYMENT", - Action: func(c *cli.Context) { run(c, deleteDeployment) }, - } -} - -func deleteDeployment(c *cli.Context) error { - args := c.Args() - if len(args) < 1 { - return errors.New("First argument, deployment name, is required. Try 'helm get --help'") - } - name := args[0] - deployment, err := NewClient(c).DeleteDeployment(name) - if err != nil { - return err - } - return format.YAML(deployment) -} diff --git a/cmd/helm/deployment.go b/cmd/helm/deployment.go index c4b7b7dee..28e93a3ea 100644 --- a/cmd/helm/deployment.go +++ b/cmd/helm/deployment.go @@ -40,6 +40,13 @@ func deploymentCommands() cli.Command { Usage: "Dump the configuration file for this deployment.", ArgsUsage: "DEPLOYMENT", }, + { + Name: "delete", + Aliases: []string{"del"}, + Usage: "Deletes the named deployment(s).", + ArgsUsage: "DEPLOYMENT [DEPLOYMENT [...]]", + Action: func(c *cli.Context) { run(c, deleteDeployment) }, + }, { Name: "manifest", Usage: "Dump the Kubernetes manifest file for this deployment.", @@ -53,15 +60,16 @@ func deploymentCommands() cli.Command { }, { Name: "list", - Usage: "list all deployments, or filter by an optional pattern", - ArgsUsage: "PATTERN", - Action: func(c *cli.Context) { run(c, list) }, + Aliases: []string{"ls"}, + Usage: "list all deployments, or filter by an optional regular expression.", + ArgsUsage: "REGEXP", + Action: func(c *cli.Context) { run(c, listDeployments) }, }, }, } } -func list(c *cli.Context) error { +func listDeployments(c *cli.Context) error { list, err := NewClient(c).ListDeployments() if err != nil { return err @@ -90,3 +98,18 @@ func list(c *cli.Context) error { format.List(list) return nil } + +func deleteDeployment(c *cli.Context) error { + args := c.Args() + if len(args) < 1 { + return errors.New("First argument, deployment name, is required. Try 'helm get --help'") + } + for _, name := range args { + deployment, err := NewClient(c).DeleteDeployment(name) + if err != nil { + return err + } + format.Info("Deleted %q at %s", name, deployment.DeletedAt) + } + return nil +} diff --git a/docs/workflow/developer-workflows.md b/docs/workflow/developer-workflows.md index 238837fd8..dcbe8aa87 100644 --- a/docs/workflow/developer-workflows.md +++ b/docs/workflow/developer-workflows.md @@ -56,7 +56,7 @@ Created wonky-panda - The client sends the server a request to deploy `helm:example.com/foo/bar`. - The server assigns a random name `wonky-panda`, fetches the chart from object storage, and goes about the deployment process. - + General patterns: ``` helm deploy [-f CONFIG] [-n NAME] [CHART] @@ -176,7 +176,7 @@ helm redeploy [-f CONFIG] NAME #### Delete: ``` -$ helm delete taco-tuesday +$ helm deployment delete taco-tuesday Destroyed taco-tuesday ``` @@ -185,10 +185,9 @@ Destroyed taco-tuesday General pattern: ``` -helm uninstall NAME [NAME...] +helm deployment delete NAME [NAME...] ``` - ### Power User Features Users familiar with the system may desire additional tools.