From cb41b2090954fbacc572407c5c500f16d74a0f96 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Thu, 17 Mar 2016 17:25:15 -0600 Subject: [PATCH] feat(repo): hook up helm repo remove cmd --- cmd/helm/helm.go | 4 ---- cmd/helm/repository.go | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index eaad0b2c3..c7a02585d 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -17,11 +17,7 @@ limitations under the License. package main import ( - "io/ioutil" - "net/http" - "net/url" "os" - "strings" "github.com/codegangsta/cli" "github.com/kubernetes/helm/pkg/client" diff --git a/cmd/helm/repository.go b/cmd/helm/repository.go index 69f3ac29d..56420dd1f 100644 --- a/cmd/helm/repository.go +++ b/cmd/helm/repository.go @@ -28,6 +28,9 @@ func init() { addCommands(repoCommands()) } +var dmURL string = "http://localhost:8080" +var chartRepoPath string = "chart_repositories" + func repoCommands() cli.Command { return cli.Command{ Name: "repository", @@ -89,11 +92,9 @@ func addRepo(c *cli.Context) error { return errors.New("'helm repo add' requires a repository as an argument") } - dmURL := "http://localhost:8080" - path := "chart_repositories" client := client.NewClient(dmURL) var dest string = "" - err := client.CallService(path, "POST", "add a chart repository", &dest, nil) + err := client.CallService(chartRepoPath, "POST", "add a chart repository", &dest, nil) if err != nil { return err } @@ -102,11 +103,9 @@ func addRepo(c *cli.Context) error { } func listRepos(c *cli.Context) error { - dmURL := "http://localhost:8080" - path := "chart_repositories" client := client.NewClient(dmURL) var dest string = "" - err := client.CallService(path, "GET", "list chart repos", &dest, nil) + err := client.CallService(chartRepoPath, "GET", "list chart repos", &dest, nil) if err != nil { return err } @@ -119,5 +118,12 @@ func removeRepo(c *cli.Context) error { if len(args) < 1 { return errors.New("'helm repo remove' requires a repository as an argument") } + client := client.NewClient(dmURL) + var dest string = "" + err := client.CallService(chartRepoPath, "DELETE", "delete a chart repository from list", &dest, nil) + if err != nil { + return err + } + format.Msg(dest) return nil }