options

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const OptDisableHooks = "disable-hooks"
View Source
const OptDisableShell = "disable-shell"
View Source
const OptMissingConfigAction = "missing-config-action"
View Source
const OptMissingKeyAction = "missing-key-action"
View Source
const OptNonInteractive = "non-interactive"
View Source
const OptOutputFolder = "output-folder"
View Source
const OptTemplateUrl = "template-url"
View Source
const OptVar = "var"
View Source
const OptVarFile = "var-file"

Variables

View Source
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
)
View Source
var (
	Exit   = MissingConfigAction("exit")
	Ignore = MissingConfigAction("ignore")
)
View Source
var AllMissingConfigActions = []MissingConfigAction{Exit, Ignore}
View Source
var AllMissingKeyActions = []MissingKeyAction{Invalid, ZeroValue, ExitWithError}
View Source
var DefaultMissingConfigAction = Exit
View Source
var DefaultMissingKeyAction = ExitWithError
View Source
var OutputFolderOptionCannotBeEmpty = fmt.Errorf("The --%s option cannot be empty", OptOutputFolder)
View Source
var TemplateUrlOptionCannotBeEmpty = fmt.Errorf("The --%s option cannot be empty", OptTemplateUrl)

Functions

func DetermineTemplateConfig

func DetermineTemplateConfig(templateUrl string) (string, string, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL