diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index ced336ac4..48f87d5e5 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -33,7 +33,6 @@ import ( "k8s.io/helm/pkg/helm" helm_env "k8s.io/helm/pkg/helm/environment" - "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/portforwarder" "k8s.io/helm/pkg/kube" tiller_env "k8s.io/helm/pkg/tiller/environment" @@ -84,8 +83,6 @@ Environment: ` func newRootCmd(out io.Writer) *cobra.Command { - var helmHomeTemp string - cmd := &cobra.Command{ Use: "helm", Short: "The Helm package manager for Kubernetes.", @@ -101,8 +98,7 @@ func newRootCmd(out io.Writer) *cobra.Command { }, } p := cmd.PersistentFlags() - p.StringVar(&helmHomeTemp, "home", helm_env.DefaultHelmHome(), "location of your Helm config. Overrides $HELM_HOME") - settings.Home = helmpath.Home(helmHomeTemp) + p.StringVar((*string)(&settings.Home), "home", helm_env.DefaultHelmHome(), "location of your Helm config. Overrides $HELM_HOME") p.StringVar(&settings.TillerHost, "host", helm_env.DefaultHelmHost(), "address of tiller. Overrides $HELM_HOST") p.StringVar(&kubeContext, "kube-context", "", "name of the kubeconfig context to use") p.BoolVar(&settings.Debug, "debug", false, "enable verbose output") diff --git a/cmd/helm/serve.go b/cmd/helm/serve.go index 028af9751..1c9a772fe 100644 --- a/cmd/helm/serve.go +++ b/cmd/helm/serve.go @@ -55,19 +55,29 @@ func newServeCmd(out io.Writer) *cobra.Command { Use: "serve", Short: "start a local http web server", Long: serveDesc, + PreRunE: func(cmd *cobra.Command, args []string) error { + return srv.complete(args) + }, RunE: func(cmd *cobra.Command, args []string) error { return srv.run() }, } f := cmd.Flags() - f.StringVar(&srv.repoPath, "repo-path", settings.Home.LocalRepository(), "local directory path from which to serve charts") + f.StringVar(&srv.repoPath, "repo-path", "", "local directory path from which to serve charts") f.StringVar(&srv.address, "address", "127.0.0.1:8879", "address to listen on") f.StringVar(&srv.url, "url", "", "external URL of chart repository") return cmd } +func (s *serveCmd) complete(args []string) error { + if s.repoPath == "" { + s.repoPath = settings.Home.LocalRepository() + } + return nil +} + func (s *serveCmd) run() error { repoPath, err := filepath.Abs(s.repoPath) if err != nil { diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index 866008844..874c0fc94 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -28,7 +28,7 @@ helm serve ``` --address string address to listen on (default "127.0.0.1:8879") - --repo-path string local directory path from which to serve charts (default "~/.helm/repository/local") + --repo-path string local directory path from which to serve charts --url string external URL of chart repository ``` @@ -45,4 +45,4 @@ helm serve ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 17-May-2017 +###### Auto generated by spf13/cobra on 18-May-2017 diff --git a/docs/man/man1/helm_serve.1 b/docs/man/man1/helm_serve.1 index f5c7d7e65..4901e245c 100644 --- a/docs/man/man1/helm_serve.1 +++ b/docs/man/man1/helm_serve.1 @@ -39,7 +39,7 @@ for more information on hosting chart repositories in a production setting. address to listen on .PP -\fB\-\-repo\-path\fP="~/.helm/repository/local" +\fB\-\-repo\-path\fP="" local directory path from which to serve charts .PP @@ -76,4 +76,4 @@ for more information on hosting chart repositories in a production setting. .SH HISTORY .PP -17\-May\-2017 Auto generated by spf13/cobra +18\-May\-2017 Auto generated by spf13/cobra