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

pull/613/head
Michelle Noorali 9 years ago
parent fbd6ffa4b9
commit a5a1ef9546

@ -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. Versioned chart archives are used by Helm package repositories.
` `
var save bool
func init() { func init() {
packageCmd.Flags().BoolVar(&save, "save", true, "save packaged chart to local chart repository")
RootCommand.AddCommand(packageCmd) RootCommand.AddCommand(packageCmd)
} }
@ -50,6 +53,17 @@ func runPackage(cmd *cobra.Command, args []string) error {
return err 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. // Save to the current working directory.
cwd, err := os.Getwd() cwd, err := os.Getwd()
if err != nil { if err != nil {
@ -57,7 +71,7 @@ func runPackage(cmd *cobra.Command, args []string) error {
} }
name, err := chart.Save(ch, cwd) name, err := chart.Save(ch, cwd)
if err == nil { if err == nil {
cmd.Printf("Saved %s", name) cmd.Printf("Saved %s to current directory\n", name)
} }
return err return err
} }

Loading…
Cancel
Save