Documentation ¶
Index ¶
Constants ¶
const OptDisableHooks = "disable-hooks"
const OptDisableShell = "disable-shell"
const OptMissingConfigAction = "missing-config-action"
const OptMissingKeyAction = "missing-key-action"
const OptNonInteractive = "non-interactive"
const OptOutputFolder = "output-folder"
const OptTemplateUrl = "template-url"
const OptVar = "var"
const OptVarFile = "var-file"
Variables ¶
var ( Invalid = MissingKeyAction("invalid") // print <no value> for any missing key ZeroValue = MissingKeyAction("zero") // print the zero value of the missing key ExitWithError = MissingKeyAction("error") // exit with an error when there is a missing key )
var ( Exit = MissingConfigAction("exit") Ignore = MissingConfigAction("ignore") )
var AllMissingConfigActions = []MissingConfigAction{Exit, Ignore}
var AllMissingKeyActions = []MissingKeyAction{Invalid, ZeroValue, ExitWithError}
var DefaultMissingConfigAction = Exit
var DefaultMissingKeyAction = ExitWithError
var OutputFolderOptionCannotBeEmpty = fmt.Errorf("The --%s option cannot be empty", OptOutputFolder)
var TemplateUrlOptionCannotBeEmpty = fmt.Errorf("The --%s option cannot be empty", OptTemplateUrl)
Functions ¶
func DetermineTemplateConfig ¶
DetermineTemplateConfig decides what should be passed to TemplateUrl and TemplateFolder. This parses the templateUrl and determines if it is a local path. If so, use that path directly instead of downloading it to a temp working dir. We do this by setting the template folder, which will instruct the process routine to skip downloading the template. Returns TemplateUrl, TemplateFolder, error
Types ¶
type BoilerplateOptions ¶
type BoilerplateOptions struct { // go-getter supported URL where the template can be sourced. TemplateUrl string // Working directory where the go-getter defined template is downloaded. TemplateFolder string OutputFolder string NonInteractive bool Vars map[string]interface{} OnMissingKey MissingKeyAction OnMissingConfig MissingConfigAction DisableHooks bool DisableShell bool }
The command-line options for the boilerplate app
func ParseOptions ¶
func ParseOptions(cliContext *cli.Context) (*BoilerplateOptions, error)
Parse the command line options provided by the user
func (*BoilerplateOptions) Validate ¶
func (options *BoilerplateOptions) Validate() error
Validate that the options have reasonable values and return an error if they don't
type InvalidMissingConfigAction ¶
type InvalidMissingConfigAction string
func (InvalidMissingConfigAction) Error ¶
func (err InvalidMissingConfigAction) Error() string
type InvalidMissingKeyAction ¶
type InvalidMissingKeyAction string
func (InvalidMissingKeyAction) Error ¶
func (err InvalidMissingKeyAction) Error() string
type MissingConfigAction ¶
type MissingConfigAction string
This type is an enum that represents what to do when the template folder passed to boilerplate does not contain a boilerplate.yml file.
func ParseMissingConfigAction ¶
func ParseMissingConfigAction(str string) (MissingConfigAction, error)
Convert the given string to a MissingConfigAction enum, or return an error if this is not a valid value for the MissingConfigAction enum
type MissingKeyAction ¶
type MissingKeyAction string
This type is an enum that represents what we can do when a template looks up a missing key. This typically happens when there is a typo in the variable name in a template.
func ParseMissingKeyAction ¶
func ParseMissingKeyAction(str string) (MissingKeyAction, error)
Convert the given string to a MissingKeyAction enum, or return an error if this is not a valid value for the MissingKeyAction enum