Allow Helm create starters option to use paths

Updated docs to reflect changes
pull/3672/head
Ali Rizwan 8 years ago
parent dede3ff1e1
commit ef9802f514

@ -20,6 +20,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"os"
"path/filepath" "path/filepath"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -78,7 +79,7 @@ func newCreateCmd(out io.Writer) *cobra.Command {
}, },
} }
cmd.Flags().StringVarP(&cc.starter, "starter", "p", "", "the named Helm starter scaffold") cmd.Flags().StringVarP(&cc.starter, "starter", "p", "", "the name or path of the Helm starter scaffold")
return cmd return cmd
} }
@ -97,6 +98,12 @@ func (c *createCmd) run() error {
if c.starter != "" { if c.starter != "" {
// Create from the starter // Create from the starter
lstarter := filepath.Join(c.home.Starters(), c.starter) lstarter := filepath.Join(c.home.Starters(), c.starter)
// Check without helm home
if _, err := os.Stat(lstarter); os.IsNotExist(err) {
if _, err := os.Stat(c.starter); err == nil {
lstarter = c.starter
}
}
return chartutil.CreateFrom(cfile, filepath.Dir(c.name), lstarter) return chartutil.CreateFrom(cfile, filepath.Dir(c.name), lstarter)
} }

@ -843,6 +843,7 @@ The `helm create` command takes an optional `--starter` option that lets you
specify a "starter chart". specify a "starter chart".
Starters are just regular charts, but are located in `$HELM_HOME/starters`. Starters are just regular charts, but are located in `$HELM_HOME/starters`.
You can specify the path to a starter using the `--starter` option.
As a chart developer, you may author charts that are specifically designed As a chart developer, you may author charts that are specifically designed
to be used as starters. Such charts should be designed with the following to be used as starters. Such charts should be designed with the following
considerations in mind: considerations in mind:
@ -853,6 +854,3 @@ considerations in mind:
- All occurences of `<CHARTNAME>` will be replaced with the specified chart - All occurences of `<CHARTNAME>` will be replaced with the specified chart
name so that starter charts can be used as templates. name so that starter charts can be used as templates.
Currently the only way to add a chart to `$HELM_HOME/starters` is to manually
copy it there. In your chart's documentation, you may want to explain that
process.

Loading…
Cancel
Save