Commit a5a1ef95 authored by Michelle Noorali's avatar Michelle Noorali

feat(package): save package to $HELM_HOME/local

parent fbd6ffa4
......@@ -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
}
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