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 ( ...@@ -5,12 +5,14 @@ import (
"os" "os"
"github.com/deis/tiller/pkg/repo" "github.com/deis/tiller/pkg/repo"
"github.com/gosuri/uitable"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )
func init() { func init() {
repoCmd.AddCommand(repoAddCmd) repoCmd.AddCommand(repoAddCmd)
repoCmd.AddCommand(repoListCmd)
RootCommand.AddCommand(repoCmd) RootCommand.AddCommand(repoCmd)
} }
...@@ -25,6 +27,12 @@ var repoAddCmd = &cobra.Command{ ...@@ -25,6 +27,12 @@ var repoAddCmd = &cobra.Command{
RunE: runRepoAdd, RunE: runRepoAdd,
} }
var repoListCmd = &cobra.Command{
Use: "list [flags]",
Short: "list chart repositories",
RunE: runRepoList,
}
func runRepoAdd(cmd *cobra.Command, args []string) error { func runRepoAdd(cmd *cobra.Command, args []string) error {
if len(args) != 2 { 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") 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 { ...@@ -38,6 +46,25 @@ func runRepoAdd(cmd *cobra.Command, args []string) error {
return nil 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 { func insertRepoLine(name, url string) error {
err := checkUniqueName(name) err := checkUniqueName(name)
if err != nil { if err != nil {
......
hash: 78e69db1e2c08b4c326c61c47d602ccb5d0d4a782e5047a460e984d0c22f43a3 hash: 998d87445fec0bd715fa5ccbcc227cb4997e56ceff58dc8eb53ea2e0cc84abfd
updated: 2016-04-27T13:31:53.384640094-07:00 updated: 2016-04-27T16:11:47.531200165-06:00
imports: imports:
- name: bitbucket.org/ww/goautoneg - name: bitbucket.org/ww/goautoneg
version: 75cd24fc2f2c version: 75cd24fc2f2c
...@@ -121,6 +121,11 @@ imports: ...@@ -121,6 +121,11 @@ imports:
- version - version
- name: github.com/google/gofuzz - name: github.com/google/gofuzz
version: bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5 version: bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5
- name: github.com/gosuri/uitable
version: 36ee7e946282a3fb1cfecd476ddc9b35d8847e42
subpackages:
- util/strutil
- util/wordwrap
- name: github.com/imdario/mergo - name: github.com/imdario/mergo
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
- name: github.com/inconshreveable/mousetrap - name: github.com/inconshreveable/mousetrap
...@@ -131,6 +136,8 @@ imports: ...@@ -131,6 +136,8 @@ imports:
version: 808ed7761c233af2de3f9729a041d68c62527f3a version: 808ed7761c233af2de3f9729a041d68c62527f3a
- name: github.com/Masterminds/sprig - name: github.com/Masterminds/sprig
version: e6494bc7e81206ba6db404d2fd96500ffc453407 version: e6494bc7e81206ba6db404d2fd96500ffc453407
- name: github.com/mattn/go-runewidth
version: d6bea18f789704b5f83375793155289da36a3c7f
- name: github.com/matttproud/golang_protobuf_extensions - name: github.com/matttproud/golang_protobuf_extensions
version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a
subpackages: subpackages:
......
...@@ -26,6 +26,7 @@ import: ...@@ -26,6 +26,7 @@ import:
- package: k8s.io/kubernetes - package: k8s.io/kubernetes
version: ^1.2 version: ^1.2
subpackages: subpackages:
- pkg/client/unversioned/clientcmd - pkg/client/unversioned/clientcmd
- pkg/kubectl/cmd/util - pkg/kubectl/cmd/util
- pkg/kubectl/resource - 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