ref(repo): client uses public repo.Repo struct

pull/448/head
Michelle Noorali 9 years ago
parent f2180cea92
commit 179f521640

@ -20,6 +20,7 @@ import (
"errors" "errors"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/kubernetes/helm/pkg/format" "github.com/kubernetes/helm/pkg/format"
"github.com/kubernetes/helm/pkg/repo"
) )
func init() { func init() {
@ -73,20 +74,24 @@ func addRepo(c *cli.Context) error {
if len(args) < 1 { if len(args) < 1 {
return errors.New("'helm repo add' requires a repository as an argument") return errors.New("'helm repo add' requires a repository as an argument")
} }
dest := "" repoURL := args[0]
if _, err := NewClient(c).Post(chartRepoPath, nil, &dest); err != nil { dest := repo.Repo{}
if _, err := NewClient(c).Post(chartRepoPath, repoURL, &dest); err != nil {
return err return err
} }
format.Msg(dest) format.Msg(dest.URL + "has been added to your list of chart repositories")
return nil return nil
} }
func listRepos(c *cli.Context) error { func listRepos(c *cli.Context) error {
dest := "" dest := []repo.Repo{}
if _, err := NewClient(c).Get(chartRepoPath, &dest); err != nil { if _, err := NewClient(c).Get(chartRepoPath, &dest); err != nil {
return err return err
} }
format.Msg(dest) format.Msg("Chart Repositories:")
for _, r := range dest {
format.Msg(r.URL + "\n")
}
return nil return nil
} }
@ -95,10 +100,11 @@ 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")
} }
dest := "" repoURL := args[0]
dest := repo.Repo{URL: repoURL}
if _, err := NewClient(c).Delete(chartRepoPath, &dest); err != nil { if _, err := NewClient(c).Delete(chartRepoPath, &dest); err != nil {
return err return err
} }
format.Msg(dest) format.Msg(dest.URL + "has been removed.\n")
return nil return nil
} }

Loading…
Cancel
Save