Commit d3de044f authored by Michelle Noorali's avatar Michelle Noorali

Merge pull request #69 from michelleN/helm-repo-list

feat(helm): add helm repo list command
parents 0ebeecbd b6411be7
......@@ -5,12 +5,14 @@ import (
"os"
"github.com/deis/tiller/pkg/repo"
"github.com/gosuri/uitable"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
)
func init() {
repoCmd.AddCommand(repoAddCmd)
repoCmd.AddCommand(repoListCmd)
RootCommand.AddCommand(repoCmd)
}
......@@ -25,6 +27,12 @@ var repoAddCmd = &cobra.Command{
RunE: runRepoAdd,
}
var repoListCmd = &cobra.Command{
Use: "list [flags]",
Short: "list chart repositories",
RunE: runRepoList,
}
func runRepoAdd(cmd *cobra.Command, args []string) error {
if len(args) != 2 {
return fmt.Errorf("This command needs two argument, a name for the chart repository and the url of the chart repository")
......@@ -38,6 +46,25 @@ func runRepoAdd(cmd *cobra.Command, args []string) error {
return nil
}
func runRepoList(cmd *cobra.Command, args []string) error {
f, err := repo.LoadRepositoriesFile(repositoriesFile())
if err != nil {
return err
}
if len(f.Repositories) == 0 {
fmt.Println("No repositories to show")
return nil
}
table := uitable.New()
table.MaxColWidth = 50
table.AddRow("NAME", "URL")
for k, v := range f.Repositories {
table.AddRow(k, v)
}
fmt.Println(table)
return nil
}
func insertRepoLine(name, url string) error {
err := checkUniqueName(name)
if err != nil {
......
hash: 78e69db1e2c08b4c326c61c47d602ccb5d0d4a782e5047a460e984d0c22f43a3
updated: 2016-04-27T13:31:53.384640094-07:00
hash: 998d87445fec0bd715fa5ccbcc227cb4997e56ceff58dc8eb53ea2e0cc84abfd
updated: 2016-04-27T16:11:47.531200165-06:00
imports:
- name: bitbucket.org/ww/goautoneg
version: 75cd24fc2f2c
......@@ -121,6 +121,11 @@ imports:
- version
- name: github.com/google/gofuzz
version: bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5
- name: github.com/gosuri/uitable
version: 36ee7e946282a3fb1cfecd476ddc9b35d8847e42
subpackages:
- util/strutil
- util/wordwrap
- name: github.com/imdario/mergo
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
- name: github.com/inconshreveable/mousetrap
......@@ -131,6 +136,8 @@ imports:
version: 808ed7761c233af2de3f9729a041d68c62527f3a
- name: github.com/Masterminds/sprig
version: e6494bc7e81206ba6db404d2fd96500ffc453407
- name: github.com/mattn/go-runewidth
version: d6bea18f789704b5f83375793155289da36a3c7f
- name: github.com/matttproud/golang_protobuf_extensions
version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a
subpackages:
......
......@@ -26,6 +26,7 @@ import:
- package: k8s.io/kubernetes
version: ^1.2
subpackages:
- pkg/client/unversioned/clientcmd
- pkg/kubectl/cmd/util
- pkg/kubectl/resource
- pkg/client/unversioned/clientcmd
- pkg/kubectl/cmd/util
- pkg/kubectl/resource
- package: github.com/gosuri/uitable
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