ref(repo:) handle zero chart repos gracefully

pull/448/head
Michelle Noorali 10 years ago
parent 179f521640
commit 911dc0a088

@ -38,20 +38,9 @@ func repoCommands() cli.Command {
{ {
Name: "add", Name: "add",
Usage: "Add a repository to the remote manager.", Usage: "Add a repository to the remote manager.",
ArgsUsage: "REPOSITORY", ArgsUsage: "REPOSITORY_URL",
Flags: []cli.Flag{
cli.StringFlag{
Name: "cred",
Usage: "The name of the credential.",
},
},
Action: func(c *cli.Context) { run(c, addRepo) }, Action: func(c *cli.Context) { run(c, addRepo) },
}, },
{
Name: "show",
Usage: "Show the repository details for a given repository.",
ArgsUsage: "REPOSITORY",
},
{ {
Name: "list", Name: "list",
Usage: "List the repositories on the remote manager.", Usage: "List the repositories on the remote manager.",
@ -62,7 +51,7 @@ func repoCommands() cli.Command {
Name: "remove", Name: "remove",
Aliases: []string{"rm"}, Aliases: []string{"rm"},
Usage: "Remove a repository from the remote manager.", Usage: "Remove a repository from the remote manager.",
ArgsUsage: "REPOSITORY", ArgsUsage: "REPOSITORY_URL",
Action: func(c *cli.Context) { run(c, removeRepo) }, Action: func(c *cli.Context) { run(c, removeRepo) },
}, },
}, },
@ -88,10 +77,15 @@ func listRepos(c *cli.Context) error {
if _, err := NewClient(c).Get(chartRepoPath, &dest); err != nil { if _, err := NewClient(c).Get(chartRepoPath, &dest); err != nil {
return err return err
} }
format.Msg("Chart Repositories:") if len(dest) < 1 {
format.Info("Looks like you don't have any chart repositories.")
format.Info("Add a chart repository using the `helm repo add [REPOSITORY_URL]` command.")
} else {
format.Msg("Chart Repositories:\n")
for _, r := range dest { for _, r := range dest {
format.Msg(r.URL + "\n") format.Msg(r.URL + "\n")
} }
}
return nil return nil
} }

Loading…
Cancel
Save