Documentation
¶
Index ¶
- func Init(cobraCommand *cobra.Command, contextVariables []option.ContextVariable)
- func PreRun(cobraCommand *cobra.Command, args []string, configName string, ...)
- func SetCobraFlag(cobraCommand *cobra.Command, contextVariable option.ContextVariable)
- func Version(version string, iteration string) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(cobraCommand *cobra.Command, contextVariables []option.ContextVariable)
Performs cobra.Flags.<datatype> operations on a list of contextVariables.
Example ¶
cobraCommand := &cobra.Command{
Use: "example-use",
Short: "example-short",
Long: `example-long`,
}
var contextVariables = []option.ContextVariable{
{
Default: "",
Envar: "MY_VARIABLE",
Help: "Description of my variable [%s]",
Arg: "my-variable",
Type: optiontype.String,
},
}
Init(cobraCommand, contextVariables)
func PreRun ¶
func PreRun(cobraCommand *cobra.Command, args []string, configName string, contextVariables []option.ContextVariable)
A function that can be wrapped for use by cobra.Command.PreRun.
Example ¶
cobraCommand := &cobra.Command{
Use: "example-use",
Short: "example-short",
Long: `example-long`,
}
var contextVariables = []option.ContextVariable{
{
Default: "",
Envar: "MY_VARIABLE",
Help: "Description of my variable [%s]",
Arg: "my-variable",
Type: optiontype.String,
},
}
Init(cobraCommand, contextVariables)
PreRun(cobraCommand, []string{}, "example-cmd", contextVariables)
func SetCobraFlag ¶
func SetCobraFlag(cobraCommand *cobra.Command, contextVariable option.ContextVariable)
Performs cobra.Flag.<datatype> on a option.ContextVariable.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.