feat(repo): hook up helm repo remove cmd

pull/404/head
Michelle Noorali 9 years ago
parent 10153528a0
commit cb41b20909

@ -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() {
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 {
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 {
} }
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 {
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
} }

Loading…
Cancel
Save