From a5a1ef95461add8e5bf3cd41500fc28ea43932ea Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Mon, 18 Apr 2016 21:59:42 -0600 Subject: [PATCH] feat(package): save package to $HELM_HOME/local --- cmd/helm/package.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmd/helm/package.go b/cmd/helm/package.go index 217e0c018..7f7037de1 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -20,7 +20,10 @@ Chart.yaml file, and (if found) build the current directory into a chart. Versioned chart archives are used by Helm package repositories. ` +var save bool + func init() { + packageCmd.Flags().BoolVar(&save, "save", true, "save packaged chart to local chart repository") RootCommand.AddCommand(packageCmd) } @@ -50,6 +53,17 @@ func runPackage(cmd *cobra.Command, args []string) error { return err } + // Save to $HELM_HOME/local directory. + if save { + dir := LocalDirectory(os.ExpandEnv(helmHome)) + name, err := chart.Save(ch, dir) + if err == nil { + cmd.Printf("Saved %s to $HELM_HOME/local/\n", name) + } else { + return err + } + } + // Save to the current working directory. cwd, err := os.Getwd() if err != nil { @@ -57,7 +71,7 @@ func runPackage(cmd *cobra.Command, args []string) error { } name, err := chart.Save(ch, cwd) if err == nil { - cmd.Printf("Saved %s", name) + cmd.Printf("Saved %s to current directory\n", name) } return err }