Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayHelp ¶
func DisplayHelp(filename string)
DisplayHelp takes a filename and prints the help information for the program.
func DisplayVersion ¶
func DisplayVersion(filename string)
DisplayVersion prints the version information for the program.
func ParseArgs ¶
func ParseArgs(args []string) map[OptionType][]string
ParseArgs take a string slice comprised of sources, includes, flags, switches and their values and returns a map of these types to a string slice of the values of each type of option.
Types ¶
type CLI ¶
type CLI struct {
Filename string
Options map[OptionType][]string
}
CLI defines a data structure that represents the application's name and a map of the various options to be used when starting the container.
func ParseOsArgs ¶
ParseOsArgs takes a string slice representing the full arguments passed to the program, including the filename and returns a CLI containing the filename and map of option types to their values.
type OptionType ¶
type OptionType int
OptionType allows for the enumeration of different CLI option types.
const ( // None indicates that no option type is available. None OptionType = iota // Arg indicates that the option is an argument to be passed to the // executing code. Arg OptionType = iota // BuildArg indicates that the option is an argument to be passed to the // compiler if one is used for the target language. BuildArg OptionType = iota // Source indicates that the option is a source file. Source OptionType = iota // Include indicates that the option is a file or folder to be mounted // in the Docker container without passing it to the compiler or // executing code. Include OptionType = iota // Image indicates that the option value should be used to // override the image worked out based on the file extension. Image OptionType = iota // TargetDir indicates that the option specifies a custom location (i.e. // not the current working directory) to which the sources are // relatively specified. TargetDir OptionType = iota // UpdateFlag indicates that the option specifies that Docker images should // be manually updated before being used. UpdateFlag OptionType = iota // HelpFlag indicates that the option specifies the help flag. HelpFlag OptionType = iota // VersionFlag indicates that the option specifies the version flag. VersionFlag OptionType = iota // Extension specifies the override file extenision to use. Extension OptionType = iota // CleanFlag indicates that the option specifies the clean flag. CleanFlag OptionType = iota )
func ArgToOption ¶
ArgToOption takes two candidate strings and returns a tuple consisting of what type of option the strings define, the value of the option, how many of the strings it took to extract the option value, and a nillable error.