Commit cb41b209 authored by Michelle Noorali's avatar Michelle Noorali

feat(repo): hook up helm repo remove cmd

parent 10153528
...@@ -17,11 +17,7 @@ limitations under the License. ...@@ -17,11 +17,7 @@ limitations under the License.
package main package main
import ( import (
"io/ioutil"
"net/http"
"net/url"
"os" "os"
"strings"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/kubernetes/helm/pkg/client" "github.com/kubernetes/helm/pkg/client"
......
...@@ -28,6 +28,9 @@ func init() { ...@@ -28,6 +28,9 @@ func init() {
addCommands(repoCommands()) addCommands(repoCommands())
} }
var dmURL string = "http://localhost:8080"
var chartRepoPath string = "chart_repositories"
func repoCommands() cli.Command { func repoCommands() cli.Command {
return cli.Command{ return cli.Command{
Name: "repository", Name: "repository",
...@@ -89,11 +92,9 @@ func addRepo(c *cli.Context) error { ...@@ -89,11 +92,9 @@ func addRepo(c *cli.Context) error {
return errors.New("'helm repo add' requires a repository as an argument") return errors.New("'helm repo add' requires a repository as an argument")
} }
dmURL := "http://localhost:8080"
path := "chart_repositories"
client := client.NewClient(dmURL) client := client.NewClient(dmURL)
var dest string = "" 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 { if err != nil {
return err return err
} }
...@@ -102,11 +103,9 @@ func addRepo(c *cli.Context) error { ...@@ -102,11 +103,9 @@ func addRepo(c *cli.Context) error {
} }
func listRepos(c *cli.Context) error { func listRepos(c *cli.Context) error {
dmURL := "http://localhost:8080"
path := "chart_repositories"
client := client.NewClient(dmURL) client := client.NewClient(dmURL)
var dest string = "" 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 { if err != nil {
return err return err
} }
...@@ -119,5 +118,12 @@ func removeRepo(c *cli.Context) error { ...@@ -119,5 +118,12 @@ func removeRepo(c *cli.Context) error {
if len(args) < 1 { if len(args) < 1 {
return errors.New("'helm repo remove' requires a repository as an argument") 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 return nil
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment