From 911dc0a0883b1c42c6a2ce5f1d2d3b867c8c9a3d Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Tue, 22 Mar 2016 16:11:47 -0600 Subject: [PATCH] ref(repo:) handle zero chart repos gracefully --- cmd/helm/repository.go | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/cmd/helm/repository.go b/cmd/helm/repository.go index 27b82cf83..d513bef43 100644 --- a/cmd/helm/repository.go +++ b/cmd/helm/repository.go @@ -38,19 +38,8 @@ func repoCommands() cli.Command { { Name: "add", Usage: "Add a repository to the remote manager.", - ArgsUsage: "REPOSITORY", - Flags: []cli.Flag{ - cli.StringFlag{ - Name: "cred", - Usage: "The name of the credential.", - }, - }, - Action: func(c *cli.Context) { run(c, addRepo) }, - }, - { - Name: "show", - Usage: "Show the repository details for a given repository.", - ArgsUsage: "REPOSITORY", + ArgsUsage: "REPOSITORY_URL", + Action: func(c *cli.Context) { run(c, addRepo) }, }, { Name: "list", @@ -62,7 +51,7 @@ func repoCommands() cli.Command { Name: "remove", Aliases: []string{"rm"}, Usage: "Remove a repository from the remote manager.", - ArgsUsage: "REPOSITORY", + ArgsUsage: "REPOSITORY_URL", Action: func(c *cli.Context) { run(c, removeRepo) }, }, }, @@ -88,9 +77,14 @@ func listRepos(c *cli.Context) error { if _, err := NewClient(c).Get(chartRepoPath, &dest); err != nil { return err } - format.Msg("Chart Repositories:") - for _, r := range dest { - format.Msg(r.URL + "\n") + 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 { + format.Msg(r.URL + "\n") + } } return nil }