boa

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 14 Imported by: 2

README

Boa

Build Status GoReportCard Go Reference

Boa is a wrapper for the popular Cobra and Viper libraries. It streamlines the building of Cobra Commands and Viper configuration, making them easier to create, read and maintain.

Disclaimer

This project should be considered unstable until it is officially released. Use at your own risk.

CobraCmdBuilder

Boa wraps the construction of Cobra commands in a builder as opposed to the struct literal approach taken by the cobra-cli(and most other Cobra users). If you initialize a new cobra-cli project, you'll end up with something like this:

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
	Use:   "example",
	Short: "A brief description of your application",
	Long: `A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
	// Uncomment the following line if your bare application
	// has an action associated with it:
	// Run: func(cmd *cobra.Command, args []string) { },
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
	err := rootCmd.Execute()
	if err != nil {
		os.Exit(1)
	}
}

func init() {
	// Here you will define your flags and configuration settings.
	// Cobra supports persistent flags, which, if defined here,
	// will be global for your application.

	// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.test.yaml)")

	// Cobra also supports local flags, which will only run
	// when this action is called directly.
	rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

While this is small and manageable at first, things can quickly get messy. Conversely, this is (roughly) the same command using boa:

func NewRootCmd() *cobra.Command {
	long := `A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`

	return boa.NewCobraCmd("root").
		WithShortDescription("A brief description of your application").
		WithLongDescription(long).
		WithSubCommands(NewChildCmd()).
		WithBoolPFlag("toggle", "t", false, "Help message for toggle").
		WithStringPPersistentFlag("verbosity", "V", "info", "How verbose should command output be").
		Build()
}

where NewChildCmd() is defined in another file

func NewChildCmd() *cobra.Command {
	return boa.NewCobraCmd("child").
		WithShortDescription("A subcommand of root").
		WithLongDescription("A detailed description for the child command").
		WithArgs(cobra.MatchAll(cobra.MinimumNArgs(1), cobra.OnlyValidArgs)).
		WithValidArgs([]string{"arg1", "arg2"}).
		WithRunFunc(childFunc).
		Build()
}

func childFunc(cmd *cobra.Command, args []string) {
	//business logic here; recommend abstracting it to a separate package that is cobra agnostic
}

and your main package is kept as minimal as possible

func main() {
	err := cmd.NewRootCmd().Execute()
	if err != nil {
		log.Fatal(err)
	}
}

BoaCmdBuilder

If you are perfectly content with the traditional Cobra CLI in which the positional args are unknown and therefore aren't listed in the help/usage text, you likely have no need for a boa.Command. A good example of a CLI like this is kubectl.

kubectl logs -f <what pod name?>
kubectl apply -f <what manifest?>
kubectl describe deployment <what deployment?>

In a CLI like kubectl, the CLI doesn't have static information about the arguments applied to its commands, therefore the default Cobra command works perfectly fine.

Let's imagine for a second that you're building a CLI that does have static positional args. For example:

mycoolcli install kubectl helm skaffold
|         |       |       |    |
|         |       |-------|----| static positional args
|         |
|         |- sub command
|
|- root command

In a situation like this you likely do want to see the positional args in your help/usage text. You might also want to see a helpful description about each argument. To accomplish this, you would ordinarily have to override the cobra.Command's help/usage function(s)/template(s); however, a boa.Command can support this without sacrificing the power of the cobra.Command and the boa.CobraCmdBuilder.

A boa.Command embeds the cobra.Command and wraps it with new fields in an effort to cover additional uses cases like the one detailed above. Similarly, the BoaCmdBuilder embeds the CobraCmdBuilder and wraps it with additional methods to facilitate adding non-cobra.Command native fields and overriding the help/usage function(s)/template(s) more easily.

A BoaCmdBuilder can seamlessly chain into a CobraCmdBuilder, but not viceversa. For example, this is valid:

func NewInstallCmd() *cobra.Command {
	return boa.NewCmd("install").
		WithValidOptions(
			boa.Option{Args: []string{"kubectl"}, Desc: "install kubectl"},
			boa.Option{Args: []string{"helm"}, Desc: "install helm"},
			boa.Option{Args: []string{"skaffold"}, Desc: "install skaffold"},
		).
		WithOptionsTemplate().
		WithMinValidArgs(1).
		WithShortDescription("install tools").
		WithLongDescription("install tools that make a productive kubernetes developer").
		WithRunFunc(install).
		Build()
}

but this is not:

func NewInstallCmd() *boa.Command {
	return boa.NewCmd("install").
		WithShortDescription("install tools").
		WithLongDescription("install tools that make a productive kubernetes developer").
		WithRunFunc(install).
		WithValidOptions(
			boa.Option{Args: []string{"kubectl"}, Desc: "install kubectl"},
			boa.Option{Args: []string{"helm"}, Desc: "install helm"},
			boa.Option{Args: []string{"skaffold"}, Desc: "install skaffold"},
		).
		WithOptionsTemplate().
		WithMinValidArgs(1).
		Build()
}

WithValidOptions(), WithOptionsTemplate(), and WithMinValidArgs() are methods on the BoaCmdBuilder which embeds the CobraCmdBuilder and therefore has access to all of its methods. This is why the BoaCmdBuilder methods can chain into CobraCmdBuilder methods, but the reverse is not true unless you use the ToBoaCmdBuilder() method on the CobraCmdBuilder. If we look at the previously invalid example, we can make it valid by chaining ToBoaCmdBuilder().

func NewInstallCmd() *boa.Command {
	return boa.NewCmd("install").
		WithShortDescription("install tools").
		WithLongDescription("install tools that make a productive kubernetes developer").
		WithRunFunc(install).
		ToBoaCmdBuilder().
		WithValidOptions(
			boa.Option{Args: []string{"kubectl"}, Desc: "install kubectl"},
			boa.Option{Args: []string{"helm"}, Desc: "install helm"},
			boa.Option{Args: []string{"skaffold"}, Desc: "install skaffold"},
		).
		WithOptionsTemplate().
		WithMinValidArgs(1).
		Build()
}

Let's see the help text of mycoolcli install now that boa.Command vs cobra.Command and BoaCmdBuilder vs CobraCmdBuilder have been addressed.

Usage:
  mycoolcli install [flags] [options]

Options:
  kubectl    install kubectl
  helm       install helm
  skaffold   install skaffold

Flags:
  -h, --help   help for install

boa.Commands also support profiles, which simply means that you can define an argument as a shorthand for a set of other options. In practice this looks something like:

func NewInstallCmd() *cobra.Command {
	return boa.NewCmd("install").
		WithValidOptions(
			boa.Option{Args: []string{"kubectl"}, Desc: "install kubectl"},
			boa.Option{Args: []string{"helm"}, Desc: "install helm"},
			boa.Option{Args: []string{"skaffold"}, Desc: "install skaffold"},
		).
		WithValidProfiles(
			boa.Profile{Args: []string{"core"}, Opts: []string{"kubectl", "helm"}, Desc: "install core tools for working with k8s"},
			boa.Profile{Args: []string{"developer", "dev"}, Opts: []string{"kubectl", "helm", "skaffold"}, Desc: "install k8s developer tools"},
		).
		WithOptionsTemplate().
		WithMinValidArgs(1).
		WithShortDescription("install tools").
		WithLongDescription("install tools that make a productive kubernetes developer").
		WithRunFunc(install).
		Build()

which results in the following usage:

Usage:
  mycoolcli install [flags] [options]

Options:
  kubectl    install kubectl
  helm       install helm
  skaffold   install skaffold

Profiles:
  core             install core tools for working with k8s
    ↳ Options:     kubectl, helm
  developer, dev   install k8s developer tools
    ↳ Options:     kubectl, helm, skaffold

Flags:
  -h, --help   help for install

It's important to note that Options and Profiles simply end up in the cobra.Commands/boa.Commands args slice. It is up to the user to determine what an option or profile type of argument means for their application.

ViperCfgBuilder

Currently, Boa doesn't extensively wrap Viper. Viper is moving towards v2 and it doesn't lend itself to being wrapped in a builder as well as Cobra. That said, Boa does offer a simple builder for initializing Viper configuration and includes a sane default configuration that can be used. If your use case is more complicated than simply pointing at a config file(s) and reading it in, Boa's ViperCfgBuilder probably isn't worth your time. If your use-case is simple, read on.

To initialize Viper configuration that searches in the user's current working directory and their XDG_CONFIG_HOME in that respective order, you can use the NewDefaultViperCfg() function.

// define your configuration schema; viper uses [mapstructure](https://pkg.go.dev/github.com/mitchellh/mapstructure)
// type Schema struct {
// 	Cfg     SomeStruct            `mapstructure:"config"`
// 	MoreCfg map[string]SomeStruct `mapstructure:"moreConfig"`
// }
// var cfg Schema
viper := boa.NewDefaultViperCfg("boa").Build()
err := viper.UnmarshalExact(&cfg)

If the defaults don't work for you, you can always build your own!

viper := boa.NewViperCfg().
	WithConfigPaths("/potential/path/to/config", "/another/one").
	WithConfigName("my-cool-config").
	ReadInConfig().
	Build()

or

viper := boa.NewViperCfg().
	WithConfigFiles("/potential/path/to/config.yml", "/another/one/config.json").
	ReadInConfigAndBuild()

It's important to note that the ReadInConfig() and ReadInConfigAndBuild() methods can encounter an error and will log fatal if so. If you need to handle the error differently, Build() first, then call viper.ReadInConfig() yourself.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoaCmdBuilder

type BoaCmdBuilder struct {
	*CobraCmdBuilder
	// contains filtered or unexported fields
}

BoaCmdBuilder is a wrapper for the CobraCmdBuilder that allows for building boa Commands using the same builder methods as a CobraCmdBuilder, but with additional builder methods specific to a boa Command.

func NewCmd

func NewCmd(use string) *BoaCmdBuilder

NewCmd creates a new BoaCmdBuilder and sets the use for the underlying cobra Command.

func ToBoaCmdBuilder

func ToBoaCmdBuilder(cmd *cobra.Command) *BoaCmdBuilder

ToBoaCmdBuilder is used to convert a cobra.Command to a BoaCmdBuilder.

func (*BoaCmdBuilder) Build

func (b *BoaCmdBuilder) Build() *Command

Build returns a boa Command from a BoaCmdBuilder

func (*BoaCmdBuilder) BuildCobraCmd

func (b *BoaCmdBuilder) BuildCobraCmd() *cobra.Command

BuildCobraCmd returns a cobra.Command from a BoaCmdBuilder

This method allows bypassing the ToCobraCmdBuilder() step before Build()

func (*BoaCmdBuilder) ToCobraCmdBuilder

func (b *BoaCmdBuilder) ToCobraCmdBuilder() *CobraCmdBuilder

ToCobraCmdBuilder returns a CobraCmdBuilder from a BoaCmdBuilder

This method isn't particularly useful as a BoaCmdBuilder is also a CobraCmdBuilder and has access to all CobraCmdBuilder methods; however, it does give the user the choice to make it more apparent to others that subsequent methods are specific to a CobraCmdBuilder.

func (*BoaCmdBuilder) WithHelpTemplate

func (b *BoaCmdBuilder) WithHelpTemplate(template string) *BoaCmdBuilder

WithHelpTemplate is used to add a custom template for help text

func (*BoaCmdBuilder) WithMaxValidArgs added in v0.2.0

func (b *BoaCmdBuilder) WithMaxValidArgs(maxArgs int) *BoaCmdBuilder

WithMaxValidArgs will cause the command to throw an error if more than maxArgs valid arguments are provided

func (*BoaCmdBuilder) WithMinValidArgs added in v0.2.0

func (b *BoaCmdBuilder) WithMinValidArgs(minArgs int) *BoaCmdBuilder

WithMinValidArgs will cause the command to throw an error if at least minArgs valid arguments are not provided

func (*BoaCmdBuilder) WithOptions

func (b *BoaCmdBuilder) WithOptions(opts ...Option) *BoaCmdBuilder

WithOptions is used to add any number of options to the boa Command

func (*BoaCmdBuilder) WithOptionsTemplate

func (b *BoaCmdBuilder) WithOptionsTemplate() *BoaCmdBuilder

WithOptionsTemplate is used to add options to the usage and help text

func (*BoaCmdBuilder) WithProfiles added in v0.2.0

func (b *BoaCmdBuilder) WithProfiles(profs ...Profile) *BoaCmdBuilder

WithProfiles is used to add any number of options to the boa Command

func (*BoaCmdBuilder) WithUsageTemplate

func (b *BoaCmdBuilder) WithUsageTemplate(template string) *BoaCmdBuilder

WithUsageTemplate is used to add a custom template for usage text

func (*BoaCmdBuilder) WithValidOptions added in v0.2.0

func (b *BoaCmdBuilder) WithValidOptions(opts ...Option) *BoaCmdBuilder

WithValidOptions is used to add any number of options to the boa Command and set them as ValidArgs

func (*BoaCmdBuilder) WithValidProfiles added in v0.2.0

func (b *BoaCmdBuilder) WithValidProfiles(profs ...Profile) *BoaCmdBuilder

WithValidProfiles is used to add any number of options to the boa Command and set them as ValidArgs

type CobraCmdBuilder

type CobraCmdBuilder struct {
	// contains filtered or unexported fields
}

CobraCmdBuilder is a builder for cobra.Command fields and chaining other helpful methods. Flags can be added to a command using builder methods as well.

func NewCobraCmd

func NewCobraCmd(use string) *CobraCmdBuilder

NewCobraCmd creates a new CobraCmdBuilder and sets the use for the underlying cobra.Command

Use is the one-line usage message. Recommended syntax is as follows:

[ ] identifies an optional argument. Arguments that are not enclosed in brackets are required.
... indicates that you can specify multiple values for the previous argument.
|   indicates mutually exclusive information. You can use the argument to the left of the separator or the
    argument to the right of the separator. You cannot use both arguments in a single use of the command.
{ } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are
    optional, they are enclosed in brackets ([ ]).

Example: add [-F file | -D dir]... [-f format] profile

func ToCobraCmdBuilder

func ToCobraCmdBuilder(cmd *cobra.Command) *CobraCmdBuilder

ToCobraCmdBuilder is used to convert an existing cobra.Command to a CobraCmdBuilder.

func (*CobraCmdBuilder) Build

func (b *CobraCmdBuilder) Build() *cobra.Command

Build returns a cobra.Command from a CobraCmdBuilder

func (*CobraCmdBuilder) BuildBoaCmd

func (b *CobraCmdBuilder) BuildBoaCmd() *Command

BuildBoaCmd returns a boa Command from a CobraCmdBuilder

func (*CobraCmdBuilder) Deprecated

func (b *CobraCmdBuilder) Deprecated(deprecated string) *CobraCmdBuilder

Deprecated defines if this command is deprecated and should print this string when used

func (*CobraCmdBuilder) DisableAutoGenTag

func (b *CobraCmdBuilder) DisableAutoGenTag() *CobraCmdBuilder

DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...") will be printed by generating docs for this command.

func (*CobraCmdBuilder) DisableFlagParsing

func (b *CobraCmdBuilder) DisableFlagParsing() *CobraCmdBuilder

DisableFlagParsing DisableFlagParsing disables the flag parsing. If this is true all flags will be passed to the command as arguments.

func (*CobraCmdBuilder) DisableFlagsInUseLine

func (b *CobraCmdBuilder) DisableFlagsInUseLine() *CobraCmdBuilder

DisableFlagsInUseLine will disable the addition of [flags] to the usage line of a command when printing help or generating docs

func (*CobraCmdBuilder) DisableSuggestions

func (b *CobraCmdBuilder) DisableSuggestions() *CobraCmdBuilder

DisableSuggestions disables the suggestions based on Levenshtein distance that go along with 'unknown command' messages.

func (*CobraCmdBuilder) Hidden

func (b *CobraCmdBuilder) Hidden() *CobraCmdBuilder

Hidden defines if this command is hidden and should NOT show up in the list of available commands.

func (*CobraCmdBuilder) MarkFlagDeprecated

func (b *CobraCmdBuilder) MarkFlagDeprecated(name string, usage string) *CobraCmdBuilder

MarkFlagDeprecated indicated that a flag is deprecated in your program. It will continue to function but will not show up in help or usage messages. Using this flag will also print the given usageMessage.

func (*CobraCmdBuilder) MarkFlagHidden

func (b *CobraCmdBuilder) MarkFlagHidden(name string) *CobraCmdBuilder

MarkFlagHidden sets a flag to 'hidden' in your program. It will continue to function but will not show up in help or usage messages.

func (*CobraCmdBuilder) MarkFlagShorthandDeprecated

func (b *CobraCmdBuilder) MarkFlagShorthandDeprecated(name string, usage string) *CobraCmdBuilder

MarkFlagShorthandDeprecated will mark the shorthand of a flag deprecated in your program. It will continue to function but will not show up in help or usage messages. Using this flag will also print the given usageMessage.

func (*CobraCmdBuilder) MarkPersistentFlagDeprecated

func (b *CobraCmdBuilder) MarkPersistentFlagDeprecated(name string, usage string) *CobraCmdBuilder

MarkFlagDeprecated indicated that a flag is deprecated in your program. It will continue to function but will not show up in help or usage messages. Using this flag will also print the given usageMessage.

func (*CobraCmdBuilder) MarkPersistentFlagHidden

func (b *CobraCmdBuilder) MarkPersistentFlagHidden(name string) *CobraCmdBuilder

MarkFlagHidden sets a flag to 'hidden' in your program. It will continue to function but will not show up in help or usage messages.

func (*CobraCmdBuilder) MarkPersistentFlagShorthandDeprecated

func (b *CobraCmdBuilder) MarkPersistentFlagShorthandDeprecated(name string, usage string) *CobraCmdBuilder

MarkFlagShorthandDeprecated will mark the shorthand of a flag deprecated in your program. It will continue to function but will not show up in help or usage messages. Using this flag will also print the given usageMessage.

func (*CobraCmdBuilder) SilenceErrors

func (b *CobraCmdBuilder) SilenceErrors() *CobraCmdBuilder

SilenceErrors is an option to quiet errors down stream.

func (*CobraCmdBuilder) SilenceUsage

func (b *CobraCmdBuilder) SilenceUsage() *CobraCmdBuilder

SilenceUsage is an option to silence usage when an error occurs.

func (*CobraCmdBuilder) SuggestFor

func (b *CobraCmdBuilder) SuggestFor(cmds []string) *CobraCmdBuilder

SuggestFor is an array of command names for which this command will be suggested - similar to aliases but only suggests.

func (*CobraCmdBuilder) ToBoaCmdBuilder

func (b *CobraCmdBuilder) ToBoaCmdBuilder() *BoaCmdBuilder

ToBoaCmdBuilder returns a BoaCmdBuilder from a CobraCmdBuilder

func (*CobraCmdBuilder) TraverseChildren

func (b *CobraCmdBuilder) TraverseChildren() *CobraCmdBuilder

TraverseChildren parses flags on all parents before executing child command.

func (*CobraCmdBuilder) WithAliases

func (b *CobraCmdBuilder) WithAliases(aliases []string) *CobraCmdBuilder

WithAliases is an array of aliases that can be used instead of the first word in Use.

func (*CobraCmdBuilder) WithAnnotations

func (b *CobraCmdBuilder) WithAnnotations(annotations map[string]string) *CobraCmdBuilder

WithAnnotations are key/value pairs that can be used by applications to identify or group commands.

func (*CobraCmdBuilder) WithArgAliases

func (b *CobraCmdBuilder) WithArgAliases(argAliases []string) *CobraCmdBuilder

WithArgAliases is List of aliases for ValidArgs. These are not suggested to the user in the shell completion, but accepted if entered manually.

func (*CobraCmdBuilder) WithArgs

WithArgs sets the expected arguments for the command.

For example:

WithArgs(cobra.MatchAll(cobra.MinimumNArgs(1), cobra.OnlyValidArgs))

func (*CobraCmdBuilder) WithBashCompletionFunction

func (b *CobraCmdBuilder) WithBashCompletionFunction(bashCompletionFunction string) *CobraCmdBuilder

WithBashCompletionFunction is custom bash functions used by the legacy bash autocompletion generator. For portability with other shells, it is recommended to instead use ValidArgsFunction

func (*CobraCmdBuilder) WithBoolFlag

func (b *CobraCmdBuilder) WithBoolFlag(name string, value bool, usage string) *CobraCmdBuilder

WithBoolFlag defines a bool flag with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBoolPFlag

func (b *CobraCmdBuilder) WithBoolPFlag(name string, shorthand string, value bool, usage string) *CobraCmdBuilder

WithBoolPFlag BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolPPersistentFlag

func (b *CobraCmdBuilder) WithBoolPPersistentFlag(name string, shorthand string, value bool, usage string) *CobraCmdBuilder

WithBoolPPersistentFlag BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolPersistentFlag

func (b *CobraCmdBuilder) WithBoolPersistentFlag(name string, value bool, usage string) *CobraCmdBuilder

WithBoolPersistentFlag defines a bool flag with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBoolSliceFlag

func (b *CobraCmdBuilder) WithBoolSliceFlag(name string, value []bool, usage string) *CobraCmdBuilder

WithBoolSliceFlag defines a []bool flag with specified name, default value, and usage string. The return value is the address of a []bool variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBoolSlicePFlag

func (b *CobraCmdBuilder) WithBoolSlicePFlag(name string, shorthand string, value []bool, usage string) *CobraCmdBuilder

WithBoolSlicePFlag is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolSlicePPersistentFlag

func (b *CobraCmdBuilder) WithBoolSlicePPersistentFlag(name string, shorthand string, value []bool, usage string) *CobraCmdBuilder

WithBoolSlicePPersistentFlag is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolSlicePersistentFlag

func (b *CobraCmdBuilder) WithBoolSlicePersistentFlag(name string, value []bool, usage string) *CobraCmdBuilder

WithBoolSlicePersistentFlag defines a []bool flag with specified name, default value, and usage string. The return value is the address of a []bool variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBoolSliceVarFlag

func (b *CobraCmdBuilder) WithBoolSliceVarFlag(variable *[]bool, name string, value []bool, usage string) *CobraCmdBuilder

WithBoolSliceVarFlag defines a boolSlice flag with specified name, default value, and usage string. The argument p points to a []bool variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithBoolSliceVarPFlag

func (b *CobraCmdBuilder) WithBoolSliceVarPFlag(variable *[]bool, name string, shorthand string, value []bool, usage string) *CobraCmdBuilder

WithBoolSliceVarPFlag is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolSliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithBoolSliceVarPPersistentFlag(variable *[]bool, name string, shorthand string, value []bool, usage string) *CobraCmdBuilder

WithBoolSliceVarPPersistentFlag is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolSliceVarPersistentFlag

func (b *CobraCmdBuilder) WithBoolSliceVarPersistentFlag(variable *[]bool, name string, value []bool, usage string) *CobraCmdBuilder

WithBoolSliceVarPersistentFlag defines a boolSlice flag with specified name, default value, and usage string. The argument p points to a []bool variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithBoolVarFlag

func (b *CobraCmdBuilder) WithBoolVarFlag(variable *bool, name string, value bool, usage string) *CobraCmdBuilder

WithBoolVarFlag defines a bool flag with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithBoolVarPFlag

func (b *CobraCmdBuilder) WithBoolVarPFlag(variable *bool, name string, shorthand string, value bool, usage string) *CobraCmdBuilder

WithBoolVarPFlag is like BoolVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolVarPPersistentFlag

func (b *CobraCmdBuilder) WithBoolVarPPersistentFlag(variable *bool, name string, shorthand string, value bool, usage string) *CobraCmdBuilder

WithBoolVarPPersistentFlag is like BoolVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBoolVarPersistentFlag

func (b *CobraCmdBuilder) WithBoolVarPersistentFlag(variable *bool, name string, value bool, usage string) *CobraCmdBuilder

WithBoolVarPersistentFlag defines a bool flag with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithBytesBase64Flag

func (b *CobraCmdBuilder) WithBytesBase64Flag(name string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64Flag defines an []byte flag with specified name, default value, and usage string. The return value is the address of an []byte variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBytesBase64PFlag

func (b *CobraCmdBuilder) WithBytesBase64PFlag(name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64PFlag is like BytesBase64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesBase64PPersistentFlag

func (b *CobraCmdBuilder) WithBytesBase64PPersistentFlag(name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64PPersistentFlag is like BytesBase64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesBase64PersistentFlag

func (b *CobraCmdBuilder) WithBytesBase64PersistentFlag(name string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64PersistentFlag defines an []byte flag with specified name, default value, and usage string. The return value is the address of an []byte variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBytesBase64VarFlag

func (b *CobraCmdBuilder) WithBytesBase64VarFlag(variable *[]byte, name string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64VarFlag defines an []byte flag with specified name, default value, and usage string. The argument p points to an []byte variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithBytesBase64VarPFlag

func (b *CobraCmdBuilder) WithBytesBase64VarPFlag(variable *[]byte, name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64VarPFlag BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesBase64VarPPersistentFlag

func (b *CobraCmdBuilder) WithBytesBase64VarPPersistentFlag(variable *[]byte, name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64VarPPersistentFlag BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesBase64VarPersistentFlag

func (b *CobraCmdBuilder) WithBytesBase64VarPersistentFlag(variable *[]byte, name string, value []byte, usage string) *CobraCmdBuilder

WithBytesBase64VarPersistentFlag defines an []byte flag with specified name, default value, and usage string. The argument p points to an []byte variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithBytesHexFlag

func (b *CobraCmdBuilder) WithBytesHexFlag(name string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexFlag defines an []byte flag with specified name, default value, and usage string. The return value is the address of an []byte variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBytesHexPFlag

func (b *CobraCmdBuilder) WithBytesHexPFlag(name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexPFlag is like BytesHex, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesHexPPersistentFlag

func (b *CobraCmdBuilder) WithBytesHexPPersistentFlag(name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexPPersistentFlag is like BytesHex, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesHexPersistentFlag

func (b *CobraCmdBuilder) WithBytesHexPersistentFlag(name string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexPersistentFlag defines an []byte flag with specified name, default value, and usage string. The return value is the address of an []byte variable that stores the value of the flag.

func (*CobraCmdBuilder) WithBytesHexVarFlag

func (b *CobraCmdBuilder) WithBytesHexVarFlag(variable *[]byte, name string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexVarFlag BytesHexVar defines an []byte flag with specified name, default value, and usage string. The argument p points to an []byte variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithBytesHexVarPFlag

func (b *CobraCmdBuilder) WithBytesHexVarPFlag(variable *[]byte, name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexVarPFlag is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesHexVarPPersistentFlag

func (b *CobraCmdBuilder) WithBytesHexVarPPersistentFlag(variable *[]byte, name string, shorthand string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexVarPPersistentFlag is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithBytesHexVarPersistentFlag

func (b *CobraCmdBuilder) WithBytesHexVarPersistentFlag(variable *[]byte, name string, value []byte, usage string) *CobraCmdBuilder

WithBytesHexVarPersistentFlag BytesHexVar defines an []byte flag with specified name, default value, and usage string. The argument p points to an []byte variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithCompletionOptions

func (b *CobraCmdBuilder) WithCompletionOptions(options cobra.CompletionOptions) *CobraCmdBuilder

WithCompletionOptions is a set of options to control the handling of shell completion.

func (*CobraCmdBuilder) WithCountFlag

func (b *CobraCmdBuilder) WithCountFlag(name string, usage string) *CobraCmdBuilder

WithCountFlag defines a count flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag. A count flag will add 1 to its value every time it is found on the command line.

func (*CobraCmdBuilder) WithCountPFlag

func (b *CobraCmdBuilder) WithCountPFlag(name string, shorthand string, usage string) *CobraCmdBuilder

WithCountPFlag is like Count only takes a shorthand for the flag name.

func (*CobraCmdBuilder) WithCountPPersistentFlag

func (b *CobraCmdBuilder) WithCountPPersistentFlag(name string, shorthand string, usage string) *CobraCmdBuilder

WithCountPPersistentFlag is like Count only takes a shorthand for the flag name.

func (*CobraCmdBuilder) WithCountPersistentFlag

func (b *CobraCmdBuilder) WithCountPersistentFlag(name string, usage string) *CobraCmdBuilder

WithCountPersistentFlag defines a count flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag. A count flag will add 1 to its value every time it is found on the command line.

func (*CobraCmdBuilder) WithCountVarFlag

func (b *CobraCmdBuilder) WithCountVarFlag(variable *int, name string, usage string) *CobraCmdBuilder

WithCountVarFlag defines a count flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag. A count flag will add 1 to its value every time it is found on the command line

func (*CobraCmdBuilder) WithCountVarPFlag

func (b *CobraCmdBuilder) WithCountVarPFlag(variable *int, name string, shorthand string, usage string) *CobraCmdBuilder

WithCountVarPFlag is like CountVar only take a shorthand for the flag name.

func (*CobraCmdBuilder) WithCountVarPPersistentFlag

func (b *CobraCmdBuilder) WithCountVarPPersistentFlag(variable *int, name string, shorthand string, usage string) *CobraCmdBuilder

WithCountVarPPersistentFlag is like CountVar only take a shorthand for the flag name.

func (*CobraCmdBuilder) WithCountVarPersistentFlag

func (b *CobraCmdBuilder) WithCountVarPersistentFlag(variable *int, name string, usage string) *CobraCmdBuilder

WithCountVarPersistentFlag defines a count flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag. A count flag will add 1 to its value every time it is found on the command line

func (*CobraCmdBuilder) WithDurationFlag

func (b *CobraCmdBuilder) WithDurationFlag(name string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationFlag defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.

func (*CobraCmdBuilder) WithDurationPFlag

func (b *CobraCmdBuilder) WithDurationPFlag(name string, shorthand string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationPFlag is like Duration, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationPPersistentFlag

func (b *CobraCmdBuilder) WithDurationPPersistentFlag(name string, shorthand string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationPPersistentFlag is like Duration, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationPersistentFlag

func (b *CobraCmdBuilder) WithDurationPersistentFlag(name string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationPersistentFlag defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time .Duration variable that stores the value of the flag.

func (*CobraCmdBuilder) WithDurationSliceFlag

func (b *CobraCmdBuilder) WithDurationSliceFlag(name string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSliceFlag defines a []time.Duration flag with specified name, default value, and usage string. The return value is the address of a []time.Duration variable that stores the value of the flag.

func (*CobraCmdBuilder) WithDurationSlicePFlag

func (b *CobraCmdBuilder) WithDurationSlicePFlag(name string, shorthand string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSlicePFlag is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationSlicePPersistentFlag

func (b *CobraCmdBuilder) WithDurationSlicePPersistentFlag(name string, shorthand string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSlicePPersistentFlag is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationSlicePersistentFlag

func (b *CobraCmdBuilder) WithDurationSlicePersistentFlag(name string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSlicePersistentFlag defines a []time.Duration flag with specified name, default value, and usage string. The return value is the address of a []time.Duration variable that stores the value of the flag.

func (*CobraCmdBuilder) WithDurationSliceVarFlag

func (b *CobraCmdBuilder) WithDurationSliceVarFlag(variable *[]time.Duration, name string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSliceVarFlag defines a durationSlice flag with specified name, default value, and usage string. The argument p points to a []time.Duration variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithDurationSliceVarPFlag

func (b *CobraCmdBuilder) WithDurationSliceVarPFlag(variable *[]time.Duration, name string, shorthand string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSliceVarPFlag is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationSliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithDurationSliceVarPPersistentFlag(variable *[]time.Duration, name string, shorthand string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSliceVarPPersistentFlag is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationSliceVarPersistentFlag

func (b *CobraCmdBuilder) WithDurationSliceVarPersistentFlag(variable *[]time.Duration, name string, value []time.Duration, usage string) *CobraCmdBuilder

WithDurationSliceVarPersistentFlag defines a durationSlice flag with specified name, default value, and usage string. The argument p points to a []time.Duration variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithDurationVarFlag

func (b *CobraCmdBuilder) WithDurationVarFlag(variable *time.Duration, name string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationVarFlag defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithDurationVarPFlag

func (b *CobraCmdBuilder) WithDurationVarPFlag(variable *time.Duration, name string, shorthand string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationVarPFlag is like DurationVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationVarPPersistentFlag

func (b *CobraCmdBuilder) WithDurationVarPPersistentFlag(variable *time.Duration, name string, shorthand string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationVarPPersistentFlag is like DurationVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithDurationVarPersistentFlag

func (b *CobraCmdBuilder) WithDurationVarPersistentFlag(variable *time.Duration, name string, value time.Duration, usage string) *CobraCmdBuilder

WithDurationVarPersistentFlag defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time .Duration variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithExample

func (b *CobraCmdBuilder) WithExample(example string) *CobraCmdBuilder

WithExample is examples of how to use the command.

func (*CobraCmdBuilder) WithFParseErrWhitelist

func (b *CobraCmdBuilder) WithFParseErrWhitelist(flagParseErrors cobra.FParseErrWhitelist) *CobraCmdBuilder

WithFParseErrWhitelist flag parse errors to be ignored.

func (*CobraCmdBuilder) WithFlagSet

func (b *CobraCmdBuilder) WithFlagSet(flagset *pflag.FlagSet) *CobraCmdBuilder

WithFlagSet adds one FlagSet to another. If a flag is already present in f the flag from newSet will be ignored.

func (*CobraCmdBuilder) WithFloat32Flag

func (b *CobraCmdBuilder) WithFloat32Flag(name string, value float32, usage string) *CobraCmdBuilder

WithFloat32Flag defines a float32 flag with specified name, default value, and usage string. The return value is the address of a float32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat32PFlag

func (b *CobraCmdBuilder) WithFloat32PFlag(name string, shorthand string, value float32, usage string) *CobraCmdBuilder

WithFloat32PFlag is like Float32, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32PPersistentFlag

func (b *CobraCmdBuilder) WithFloat32PPersistentFlag(name string, shorthand string, value float32, usage string) *CobraCmdBuilder

WithFloat32PPersistentFlag is like Float32, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32PersistentFlag

func (b *CobraCmdBuilder) WithFloat32PersistentFlag(name string, value float32, usage string) *CobraCmdBuilder

WithFloat32PersistentFlag defines a float32 flag with specified name, default value, and usage string. The return value is the address of a float32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat32SliceFlag

func (b *CobraCmdBuilder) WithFloat32SliceFlag(name string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SliceFlag defines a []float32 flag with specified name, default value, and usage string. The return value is the address of a []float32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat32SlicePFlag

func (b *CobraCmdBuilder) WithFloat32SlicePFlag(name string, shorthand string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SlicePFlag is like Float32Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32SlicePPersistentFlag

func (b *CobraCmdBuilder) WithFloat32SlicePPersistentFlag(name string, shorthand string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SlicePPersistentFlag is like Float32Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32SlicePersistentFlag

func (b *CobraCmdBuilder) WithFloat32SlicePersistentFlag(name string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SlicePersistentFlag defines a []float32 flag with specified name, default value, and usage string. The return value is the address of a [ ]float32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat32SliceVarFlag

func (b *CobraCmdBuilder) WithFloat32SliceVarFlag(variable *[]float32, name string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SliceVarFlag defines a float32Slice flag with specified name, default value, and usage string. The argument p points to a []float32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithFloat32SliceVarPFlag

func (b *CobraCmdBuilder) WithFloat32SliceVarPFlag(variable *[]float32, name string, shorthand string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SliceVarPFlag is like Float32SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32SliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithFloat32SliceVarPPersistentFlag(variable *[]float32, name string, shorthand string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SliceVarPPersistentFlag is like Float32SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32SliceVarPersistentFlag

func (b *CobraCmdBuilder) WithFloat32SliceVarPersistentFlag(variable *[]float32, name string, value []float32, usage string) *CobraCmdBuilder

WithFloat32SliceVarPersistentFlag defines a float32Slice flag with specified name, default value, and usage string. The argument p points to a []float32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithFloat32VarFlag

func (b *CobraCmdBuilder) WithFloat32VarFlag(variable *float32, name string, value float32, usage string) *CobraCmdBuilder

WithFloat32VarFlag defines a float32 flag with specified name, default value, and usage string. The argument p points to a float32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithFloat32VarPFlag

func (b *CobraCmdBuilder) WithFloat32VarPFlag(variable *float32, name string, shorthand string, value float32, usage string) *CobraCmdBuilder

WithFloat32VarPFlag is like Float32Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32VarPPersistentFlag

func (b *CobraCmdBuilder) WithFloat32VarPPersistentFlag(variable *float32, name string, shorthand string, value float32, usage string) *CobraCmdBuilder

WithFloat32VarPPersistentFlag is like Float32Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat32VarPersistentFlag

func (b *CobraCmdBuilder) WithFloat32VarPersistentFlag(variable *float32, name string, value float32, usage string) *CobraCmdBuilder

WithFloat32VarPersistentFlag defines a float32 flag with specified name, default value, and usage string. The argument p points to a float32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithFloat64Flag

func (b *CobraCmdBuilder) WithFloat64Flag(name string, value float64, usage string) *CobraCmdBuilder

WithFloat64Flag defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat64PFlag

func (b *CobraCmdBuilder) WithFloat64PFlag(name string, shorthand string, value float64, usage string) *CobraCmdBuilder

WithFloat64PFlag is like Float64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64PPersistentFlag

func (b *CobraCmdBuilder) WithFloat64PPersistentFlag(name string, shorthand string, value float64, usage string) *CobraCmdBuilder

WithFloat64PPersistentFlag is like Float64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64PersistentFlag

func (b *CobraCmdBuilder) WithFloat64PersistentFlag(name string, value float64, usage string) *CobraCmdBuilder

WithFloat64PersistentFlag defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat64SliceFlag

func (b *CobraCmdBuilder) WithFloat64SliceFlag(name string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SliceFlag defines a []float64 flag with specified name, default value, and usage string. The return value is the address of a []float64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat64SlicePFlag

func (b *CobraCmdBuilder) WithFloat64SlicePFlag(name string, shorthand string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SlicePFlag is like Float64Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64SlicePPersistentFlag

func (b *CobraCmdBuilder) WithFloat64SlicePPersistentFlag(name string, shorthand string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SlicePPersistentFlag is like Float64Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64SlicePersistentFlag

func (b *CobraCmdBuilder) WithFloat64SlicePersistentFlag(name string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SlicePersistentFlag defines a []float64 flag with specified name, default value, and usage string. The return value is the address of a []float64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithFloat64SliceVarFlag

func (b *CobraCmdBuilder) WithFloat64SliceVarFlag(variable *[]float64, name string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SliceVarFlag defines a float64Slice flag with specified name, default value, and usage string. The argument p points to a []float64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithFloat64SliceVarPFlag

func (b *CobraCmdBuilder) WithFloat64SliceVarPFlag(variable *[]float64, name string, shorthand string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SliceVarPFlag is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64SliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithFloat64SliceVarPPersistentFlag(variable *[]float64, name string, shorthand string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SliceVarPPersistentFlag is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64SliceVarPersistentFlag

func (b *CobraCmdBuilder) WithFloat64SliceVarPersistentFlag(variable *[]float64, name string, value []float64, usage string) *CobraCmdBuilder

WithFloat64SliceVarPersistentFlag defines a float64Slice flag with specified name, default value, and usage string. The argument p points to a []float64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithFloat64VarFlag

func (b *CobraCmdBuilder) WithFloat64VarFlag(variable *float64, name string, value float64, usage string) *CobraCmdBuilder

WithFloat64VarFlag defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithFloat64VarPFlag

func (b *CobraCmdBuilder) WithFloat64VarPFlag(variable *float64, name string, shorthand string, value float64, usage string) *CobraCmdBuilder

WithFloat64VarPFlag is like Float64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64VarPPersistentFlag

func (b *CobraCmdBuilder) WithFloat64VarPPersistentFlag(variable *float64, name string, shorthand string, value float64, usage string) *CobraCmdBuilder

WithFloat64VarPPersistentFlag is like Float64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithFloat64VarPersistentFlag

func (b *CobraCmdBuilder) WithFloat64VarPersistentFlag(variable *float64, name string, value float64, usage string) *CobraCmdBuilder

WithFloat64VarPersistentFlag defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithGroupID

func (b *CobraCmdBuilder) WithGroupID(groupId string) *CobraCmdBuilder

WithGroupId is the group id under which this subcommand is grouped in the 'help' output of its parent.

func (*CobraCmdBuilder) WithHelpFunc

func (b *CobraCmdBuilder) WithHelpFunc(function func(*cobra.Command, []string)) *CobraCmdBuilder

WithHelpFunc sets help function. Can be defined by Application.

func (*CobraCmdBuilder) WithHelpTemplate

func (b *CobraCmdBuilder) WithHelpTemplate(template string) *CobraCmdBuilder

WithHelpTemplate sets help template to be used. Application can use it to set custom template.

func (*CobraCmdBuilder) WithIPFlag

func (b *CobraCmdBuilder) WithIPFlag(name string, value net.IP, usage string) *CobraCmdBuilder

WithIPFlag defines an net.IP flag with specified name, default value, and usage string. The return value is the address of an net.IP variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIPMaskFlag

func (b *CobraCmdBuilder) WithIPMaskFlag(name string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskFlag defines an net.IPMask flag with specified name, default value, and usage string. The return value is the address of an net.IPMask variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIPMaskPFlag

func (b *CobraCmdBuilder) WithIPMaskPFlag(name string, shorthand string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskPFlag is like IPMask, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPMaskPPersistentFlag

func (b *CobraCmdBuilder) WithIPMaskPPersistentFlag(name string, shorthand string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskPPersistentFlag is like IPMask, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPMaskPersistentFlag

func (b *CobraCmdBuilder) WithIPMaskPersistentFlag(name string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskPersistentFlag defines an net.IPMask flag with specified name, default value, and usage string. The return value is the address of an net.IPMask variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIPMaskVarFlag

func (b *CobraCmdBuilder) WithIPMaskVarFlag(variable *net.IPMask, name string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskVarFlag defines an net.IPMask flag with specified name, default value, and usage string. The argument p points to an net.IPMask variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIPMaskVarPFlag

func (b *CobraCmdBuilder) WithIPMaskVarPFlag(variable *net.IPMask, name string, shorthand string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskVarPFlag is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPMaskVarPPersistentFlag

func (b *CobraCmdBuilder) WithIPMaskVarPPersistentFlag(variable *net.IPMask, name string, shorthand string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskVarPPersistentFlag is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPMaskVarPersistentFlag

func (b *CobraCmdBuilder) WithIPMaskVarPersistentFlag(variable *net.IPMask, name string, value net.IPMask, usage string) *CobraCmdBuilder

WithIPMaskVarPersistentFlag defines an net.IPMask flag with specified name, default value, and usage string. The argument p points to an net.IPMask variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIPNetFlag

func (b *CobraCmdBuilder) WithIPNetFlag(name string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetFlag defines an net.IPNet flag with specified name, default value, and usage string. The return value is the address of an net.IPNet variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIPNetPFlag

func (b *CobraCmdBuilder) WithIPNetPFlag(name string, shorthand string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetPFlag is like IPNet, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPNetPPersistentFlag

func (b *CobraCmdBuilder) WithIPNetPPersistentFlag(name string, shorthand string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetPPersistentFlag is like IPNet, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPNetPersistentFlag

func (b *CobraCmdBuilder) WithIPNetPersistentFlag(name string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetPersistentFlag defines an net.IPNet flag with specified name, default value, and usage string. The return value is the address of an net.IPNet variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIPNetVarFlag

func (b *CobraCmdBuilder) WithIPNetVarFlag(variable *net.IPNet, name string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetVarFlag defines an net.IPNet flag with specified name, default value, and usage string. The argument p points to an net.IPNet variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIPNetVarPFlag

func (b *CobraCmdBuilder) WithIPNetVarPFlag(variable *net.IPNet, name string, shorthand string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetVarPFlag is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPNetVarPPersistentFlag

func (b *CobraCmdBuilder) WithIPNetVarPPersistentFlag(variable *net.IPNet, name string, shorthand string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetVarPPersistentFlag is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPNetVarPersistentFlag

func (b *CobraCmdBuilder) WithIPNetVarPersistentFlag(variable *net.IPNet, name string, value net.IPNet, usage string) *CobraCmdBuilder

WithIPNetVarPersistentFlag defines an net.IPNet flag with specified name, default value, and usage string. The argument p points to an net.IPNet variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIPPFlag

func (b *CobraCmdBuilder) WithIPPFlag(name string, shorthand string, value net.IP, usage string) *CobraCmdBuilder

WithIPPFlag is like IP, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPPPersistentFlag

func (b *CobraCmdBuilder) WithIPPPersistentFlag(name string, shorthand string, value net.IP, usage string) *CobraCmdBuilder

WithIPPPersistentFlag is like IP, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPPersistentFlag

func (b *CobraCmdBuilder) WithIPPersistentFlag(name string, value net.IP, usage string) *CobraCmdBuilder

WithIPPersistentFlag defines an net.IP flag with specified name, default value, and usage string. The return value is the address of an net.IP variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIPSliceFlag

func (b *CobraCmdBuilder) WithIPSliceFlag(name string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSliceFlag defines a []net.IP flag with specified name, default value, and usage string. The return value is the address of a []net.IP variable that stores the value of that flag.

func (*CobraCmdBuilder) WithIPSlicePFlag

func (b *CobraCmdBuilder) WithIPSlicePFlag(name string, shorthand string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSlicePFlag is like IPSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPSlicePPersistentFlag

func (b *CobraCmdBuilder) WithIPSlicePPersistentFlag(name string, shorthand string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSlicePPersistentFlag is like IPSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPSlicePersistentFlag

func (b *CobraCmdBuilder) WithIPSlicePersistentFlag(name string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSlicePersistentFlag defines a []net.IP flag with specified name, default value, and usage string. The return value is the address of a []net.IP variable that stores the value of that flag.

func (*CobraCmdBuilder) WithIPSliceVarFlag

func (b *CobraCmdBuilder) WithIPSliceVarFlag(variable *[]net.IP, name string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSliceVarFlag defines a ipSlice flag with specified name, default value, and usage string. The argument p points to a []net.IP variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIPSliceVarPFlag

func (b *CobraCmdBuilder) WithIPSliceVarPFlag(variable *[]net.IP, name string, shorthand string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSliceVarPFlag is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPSliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithIPSliceVarPPersistentFlag(variable *[]net.IP, name string, shorthand string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSliceVarPPersistentFlag is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPSliceVarPersistentFlag

func (b *CobraCmdBuilder) WithIPSliceVarPersistentFlag(variable *[]net.IP, name string, value []net.IP, usage string) *CobraCmdBuilder

WithIPSliceVarPersistentFlag defines a ipSlice flag with specified name, default value, and usage string. The argument p points to a []net.IP variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIPVarFlag

func (b *CobraCmdBuilder) WithIPVarFlag(variable *net.IP, name string, value net.IP, usage string) *CobraCmdBuilder

WithIPVarFlag defines an net.IP flag with specified name, default value, and usage string. The argument p points to an net.IP variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIPVarPFlag

func (b *CobraCmdBuilder) WithIPVarPFlag(variable *net.IP, name string, shorthand string, value net.IP, usage string) *CobraCmdBuilder

WithIPVarPFlag is like IPVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPVarPPersistentFlag

func (b *CobraCmdBuilder) WithIPVarPPersistentFlag(variable *net.IP, name string, shorthand string, value net.IP, usage string) *CobraCmdBuilder

WithIPVarPPersistentFlag is like IPVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIPVarPersistentFlag

func (b *CobraCmdBuilder) WithIPVarPersistentFlag(variable *net.IP, name string, value net.IP, usage string) *CobraCmdBuilder

WithIPVarPersistentFlag defines an net.IP flag with specified name, default value, and usage string. The argument p points to an net.IP variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt16Flag

func (b *CobraCmdBuilder) WithInt16Flag(name string, value int16, usage string) *CobraCmdBuilder

WithInt16Flag defines an int16 flag with specified name, default value, and usage string. The return value is the address of an int16 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt16PFlag

func (b *CobraCmdBuilder) WithInt16PFlag(name string, shorthand string, value int16, usage string) *CobraCmdBuilder

WithInt16PFlag is like Int16, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt16PPersistentFlag

func (b *CobraCmdBuilder) WithInt16PPersistentFlag(name string, shorthand string, value int16, usage string) *CobraCmdBuilder

WithInt16PPersistentFlag is like Int16, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt16PersistentFlag

func (b *CobraCmdBuilder) WithInt16PersistentFlag(name string, value int16, usage string) *CobraCmdBuilder

WithInt16PersistentFlag defines an int16 flag with specified name, default value, and usage string. The return value is the address of an int16 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt16VarFlag

func (b *CobraCmdBuilder) WithInt16VarFlag(variable *int16, name string, value int16, usage string) *CobraCmdBuilder

WithInt16VarFlag defines an int16 flag with specified name, default value, and usage string. The argument p points to an int16 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt16VarPFlag

func (b *CobraCmdBuilder) WithInt16VarPFlag(variable *int16, name string, shorthand string, value int16, usage string) *CobraCmdBuilder

WithInt16VarPFlag is like Int16Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt16VarPPersistentFlag

func (b *CobraCmdBuilder) WithInt16VarPPersistentFlag(variable *int16, name string, shorthand string, value int16, usage string) *CobraCmdBuilder

WithInt16VarPPersistentFlag is like Int16Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt16VarPersistentFlag

func (b *CobraCmdBuilder) WithInt16VarPersistentFlag(variable *int16, name string, value int16, usage string) *CobraCmdBuilder

WithInt16VarPersistentFlag defines an int16 flag with specified name, default value, and usage string. The argument p points to an int16 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt32Flag

func (b *CobraCmdBuilder) WithInt32Flag(name string, value int32, usage string) *CobraCmdBuilder

WithInt32Flag defines an int32 flag with specified name, default value, and usage string. The return value is the address of an int32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt32PFlag

func (b *CobraCmdBuilder) WithInt32PFlag(name string, shorthand string, value int32, usage string) *CobraCmdBuilder

WithInt32PFlag is like Int32, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32PPersistentFlag

func (b *CobraCmdBuilder) WithInt32PPersistentFlag(name string, shorthand string, value int32, usage string) *CobraCmdBuilder

WithInt32PPersistentFlag is like Int32, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32PersistentFlag

func (b *CobraCmdBuilder) WithInt32PersistentFlag(name string, value int32, usage string) *CobraCmdBuilder

WithInt32PersistentFlag defines an int32 flag with specified name, default value, and usage string. The return value is the address of an int32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt32SliceFlag

func (b *CobraCmdBuilder) WithInt32SliceFlag(name string, value []int32, usage string) *CobraCmdBuilder

WithInt32SliceFlag defines a []int32 flag with specified name, default value, and usage string. The return value is the address of a []int32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt32SlicePFlag

func (b *CobraCmdBuilder) WithInt32SlicePFlag(name string, shorthand string, value []int32, usage string) *CobraCmdBuilder

WithInt32SlicePFlag is like Int32Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32SlicePPersistentFlag

func (b *CobraCmdBuilder) WithInt32SlicePPersistentFlag(name string, shorthand string, value []int32, usage string) *CobraCmdBuilder

WithInt32SlicePPersistentFlag is like Int32Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32SlicePersistentFlag

func (b *CobraCmdBuilder) WithInt32SlicePersistentFlag(name string, value []int32, usage string) *CobraCmdBuilder

WithInt32SlicePersistentFlag defines a []int32 flag with specified name, default value, and usage string. The return value is the address of a []int32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt32SliceVarFlag

func (b *CobraCmdBuilder) WithInt32SliceVarFlag(variable *[]int32, name string, value []int32, usage string) *CobraCmdBuilder

WithInt32SliceVarFlag defines a int32Slice flag with specified name, default value, and usage string. The argument p points to a []int32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt32SliceVarPFlag

func (b *CobraCmdBuilder) WithInt32SliceVarPFlag(variable *[]int32, name string, shorthand string, value []int32, usage string) *CobraCmdBuilder

WithInt32SliceVarPFlag is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32SliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithInt32SliceVarPPersistentFlag(variable *[]int32, name string, shorthand string, value []int32, usage string) *CobraCmdBuilder

WithInt32SliceVarPPersistentFlag is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32SliceVarPersistentFlag

func (b *CobraCmdBuilder) WithInt32SliceVarPersistentFlag(variable *[]int32, name string, value []int32, usage string) *CobraCmdBuilder

WithInt32SliceVarPersistentFlag defines a int32Slice flag with specified name, default value, and usage string. The argument p points to a []int32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt32VarFlag

func (b *CobraCmdBuilder) WithInt32VarFlag(variable *int32, name string, value int32, usage string) *CobraCmdBuilder

WithInt32VarFlag defines an int32 flag with specified name, default value, and usage string. The argument p points to an int32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt32VarPFlag

func (b *CobraCmdBuilder) WithInt32VarPFlag(variable *int32, name string, shorthand string, value int32, usage string) *CobraCmdBuilder

WithInt32VarPFlag is like Int32Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32VarPPersistentFlag

func (b *CobraCmdBuilder) WithInt32VarPPersistentFlag(variable *int32, name string, shorthand string, value int32, usage string) *CobraCmdBuilder

WithInt32VarPPersistentFlag is like Int32Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt32VarPersistentFlag

func (b *CobraCmdBuilder) WithInt32VarPersistentFlag(variable *int32, name string, value int32, usage string) *CobraCmdBuilder

WithInt32VarPersistentFlag defines an int32 flag with specified name, default value, and usage string. The argument p points to an int32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt64Flag

func (b *CobraCmdBuilder) WithInt64Flag(name string, value int64, usage string) *CobraCmdBuilder

WithInt64Flag defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt64PFlag

func (b *CobraCmdBuilder) WithInt64PFlag(name string, shorthand string, value int64, usage string) *CobraCmdBuilder

WithInt64PFlag is like Int64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64PPersistentFlag

func (b *CobraCmdBuilder) WithInt64PPersistentFlag(name string, shorthand string, value int64, usage string) *CobraCmdBuilder

WithInt64PPersistentFlag is like Int64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64PersistentFlag

func (b *CobraCmdBuilder) WithInt64PersistentFlag(name string, value int64, usage string) *CobraCmdBuilder

WithInt64PersistentFlag defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt64SliceFlag

func (b *CobraCmdBuilder) WithInt64SliceFlag(name string, value []int64, usage string) *CobraCmdBuilder

WithInt64SliceFlag defines a []int64 flag with specified name, default value, and usage string. The return value is the address of a []int64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt64SlicePFlag

func (b *CobraCmdBuilder) WithInt64SlicePFlag(name string, shorthand string, value []int64, usage string) *CobraCmdBuilder

WithInt64SlicePFlag is like Int64Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64SlicePPersistentFlag

func (b *CobraCmdBuilder) WithInt64SlicePPersistentFlag(name string, shorthand string, value []int64, usage string) *CobraCmdBuilder

WithInt64SlicePPersistentFlag is like Int64Slice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64SlicePersistentFlag

func (b *CobraCmdBuilder) WithInt64SlicePersistentFlag(name string, value []int64, usage string) *CobraCmdBuilder

WithInt64SlicePersistentFlag defines a []int64 flag with specified name, default value, and usage string. The return value is the address of a []int64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt64SliceVarFlag

func (b *CobraCmdBuilder) WithInt64SliceVarFlag(variable *[]int64, name string, value []int64, usage string) *CobraCmdBuilder

WithInt64SliceVarFlag defines a int64Slice flag with specified name, default value, and usage string. The argument p points to a []int64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt64SliceVarPFlag

func (b *CobraCmdBuilder) WithInt64SliceVarPFlag(variable *[]int64, name string, shorthand string, value []int64, usage string) *CobraCmdBuilder

WithInt64SliceVarPFlag is like Int64SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64SliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithInt64SliceVarPPersistentFlag(variable *[]int64, name string, shorthand string, value []int64, usage string) *CobraCmdBuilder

WithInt64SliceVarPPersistentFlag is like Int64SliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64SliceVarPersistentFlag

func (b *CobraCmdBuilder) WithInt64SliceVarPersistentFlag(variable *[]int64, name string, value []int64, usage string) *CobraCmdBuilder

WithInt64SliceVarPersistentFlag defines a int64Slice flag with specified name, default value, and usage string. The argument p points to a []int64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt64VarFlag

func (b *CobraCmdBuilder) WithInt64VarFlag(variable *int64, name string, value int64, usage string) *CobraCmdBuilder

WithInt64VarFlag defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt64VarPFlag

func (b *CobraCmdBuilder) WithInt64VarPFlag(variable *int64, name string, shorthand string, value int64, usage string) *CobraCmdBuilder

WithInt64VarPFlag is like Int64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64VarPPersistentFlag

func (b *CobraCmdBuilder) WithInt64VarPPersistentFlag(variable *int64, name string, shorthand string, value int64, usage string) *CobraCmdBuilder

WithInt64VarPPersistentFlag is like Int64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt64VarPersistentFlag

func (b *CobraCmdBuilder) WithInt64VarPersistentFlag(variable *int64, name string, value int64, usage string) *CobraCmdBuilder

WithInt64VarPersistentFlag defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt8Flag

func (b *CobraCmdBuilder) WithInt8Flag(name string, value int8, usage string) *CobraCmdBuilder

WithInt8Flag defines an int8 flag with specified name, default value, and usage string. The return value is the address of an int8 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt8PFlag

func (b *CobraCmdBuilder) WithInt8PFlag(name string, shorthand string, value int8, usage string) *CobraCmdBuilder

WithInt8PFlag is like Int8, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt8PPersistentFlag

func (b *CobraCmdBuilder) WithInt8PPersistentFlag(name string, shorthand string, value int8, usage string) *CobraCmdBuilder

WithInt8PPersistentFlag is like Int8, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt8PersistentFlag

func (b *CobraCmdBuilder) WithInt8PersistentFlag(name string, value int8, usage string) *CobraCmdBuilder

WithInt8PersistentFlag defines an int8 flag with specified name, default value, and usage string. The return value is the address of an int8 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithInt8VarFlag

func (b *CobraCmdBuilder) WithInt8VarFlag(variable *int8, name string, value int8, usage string) *CobraCmdBuilder

WithInt8VarFlag defines an int8 flag with specified name, default value, and usage string. The argument p points to an int8 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithInt8VarPFlag

func (b *CobraCmdBuilder) WithInt8VarPFlag(variable *int8, name string, shorthand string, value int8, usage string) *CobraCmdBuilder

WithInt8VarPFlag is like Int8Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt8VarPPersistentFlag

func (b *CobraCmdBuilder) WithInt8VarPPersistentFlag(variable *int8, name string, shorthand string, value int8, usage string) *CobraCmdBuilder

WithInt8VarPPersistentFlag is like Int8Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithInt8VarPersistentFlag

func (b *CobraCmdBuilder) WithInt8VarPersistentFlag(variable *int8, name string, value int8, usage string) *CobraCmdBuilder

WithInt8VarPersistentFlag defines an int8 flag with specified name, default value, and usage string. The argument p points to an int8 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIntFlag

func (b *CobraCmdBuilder) WithIntFlag(name string, value int, usage string) *CobraCmdBuilder

WithIntFlag defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIntPFlag

func (b *CobraCmdBuilder) WithIntPFlag(name string, shorthand string, value int, usage string) *CobraCmdBuilder

WithIntPFlag is like Int, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntPPersistentFlag

func (b *CobraCmdBuilder) WithIntPPersistentFlag(name string, shorthand string, value int, usage string) *CobraCmdBuilder

WithIntPPersistentFlag is like Int, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntPersistentFlag

func (b *CobraCmdBuilder) WithIntPersistentFlag(name string, value int, usage string) *CobraCmdBuilder

WithIntPersistentFlag defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIntSliceFlag

func (b *CobraCmdBuilder) WithIntSliceFlag(name string, value []int, usage string) *CobraCmdBuilder

WithIntSliceFlag defines a []int flag with specified name, default value, and usage string. The return value is the address of a []int variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIntSlicePFlag

func (b *CobraCmdBuilder) WithIntSlicePFlag(name string, shorthand string, value []int, usage string) *CobraCmdBuilder

WithIntSlicePFlag is like IntSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntSlicePPersistentFlag

func (b *CobraCmdBuilder) WithIntSlicePPersistentFlag(name string, shorthand string, value []int, usage string) *CobraCmdBuilder

WithIntSlicePPersistentFlag is like IntSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntSlicePersistentFlag

func (b *CobraCmdBuilder) WithIntSlicePersistentFlag(name string, value []int, usage string) *CobraCmdBuilder

WithIntSlicePersistentFlag defines a []int flag with specified name, default value, and usage string. The return value is the address of a []int variable that stores the value of the flag.

func (*CobraCmdBuilder) WithIntSliceVarFlag

func (b *CobraCmdBuilder) WithIntSliceVarFlag(variable *[]int, name string, value []int, usage string) *CobraCmdBuilder

WithIntSliceVarFlag defines a intSlice flag with specified name, default value, and usage string. The argument p points to a []int variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIntSliceVarPFlag

func (b *CobraCmdBuilder) WithIntSliceVarPFlag(variable *[]int, name string, shorthand string, value []int, usage string) *CobraCmdBuilder

WithIntSliceVarPFlag is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntSliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithIntSliceVarPPersistentFlag(variable *[]int, name string, shorthand string, value []int, usage string) *CobraCmdBuilder

WithIntSliceVarPPersistentFlag is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntSliceVarPersistentFlag

func (b *CobraCmdBuilder) WithIntSliceVarPersistentFlag(variable *[]int, name string, value []int, usage string) *CobraCmdBuilder

WithIntSliceVarPersistentFlag defines a intSlice flag with specified name, default value, and usage string. The argument p points to a []int variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIntVarFlag

func (b *CobraCmdBuilder) WithIntVarFlag(variable *int, name string, value int, usage string) *CobraCmdBuilder

WithIntVarFlag defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithIntVarPFlag

func (b *CobraCmdBuilder) WithIntVarPFlag(variable *int, name string, shorthand string, value int, usage string) *CobraCmdBuilder

WithIntVarPFlag is like IntVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntVarPPersistentFlag

func (b *CobraCmdBuilder) WithIntVarPPersistentFlag(variable *int, name string, shorthand string, value int, usage string) *CobraCmdBuilder

WithIntVarPPersistentFlag is like IntVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithIntVarPersistentFlag

func (b *CobraCmdBuilder) WithIntVarPersistentFlag(variable *int, name string, value int, usage string) *CobraCmdBuilder

WithIntVarPersistentFlag defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithLongDescription

func (b *CobraCmdBuilder) WithLongDescription(long string) *CobraCmdBuilder

WithLongDescription is the long message shown in the 'help <this-command>' output.

func (*CobraCmdBuilder) WithNoOp

func (b *CobraCmdBuilder) WithNoOp() *CobraCmdBuilder

func (*CobraCmdBuilder) WithPersistentFlagSet

func (b *CobraCmdBuilder) WithPersistentFlagSet(flagset *pflag.FlagSet) *CobraCmdBuilder

WithPersistentFlagSet adds one FlagSet to another. If a flag is already present in f the flag from newSet will be ignored.

func (*CobraCmdBuilder) WithPersistentPostRunEFunc

func (b *CobraCmdBuilder) WithPersistentPostRunEFunc(f func(cmd *cobra.Command, args []string) error) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPersistentPostRunEFunc: PersistentPostRun but returns an error.

func (*CobraCmdBuilder) WithPersistentPostRunFunc

func (b *CobraCmdBuilder) WithPersistentPostRunFunc(f func(cmd *cobra.Command, args []string)) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPersistentPostRunFunc: children of this command will inherit and execute after PostRun.

func (*CobraCmdBuilder) WithPersistentPreRunEFunc

func (b *CobraCmdBuilder) WithPersistentPreRunEFunc(f func(cmd *cobra.Command, args []string) error) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPersistentPreRunEFunc: PersistentPreRun but returns an error.

func (*CobraCmdBuilder) WithPersistentPreRunFunc

func (b *CobraCmdBuilder) WithPersistentPreRunFunc(f func(cmd *cobra.Command, args []string)) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPersistentPreRunFunc: children of this command will inherit and execute.

func (*CobraCmdBuilder) WithPostRunEFunc

func (b *CobraCmdBuilder) WithPostRunEFunc(f func(cmd *cobra.Command, args []string) error) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPostRunEFunc: PostRun but returns an error.

func (*CobraCmdBuilder) WithPostRunFunc

func (b *CobraCmdBuilder) WithPostRunFunc(f func(cmd *cobra.Command, args []string)) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPostRunFunc: run after the Run command.

func (*CobraCmdBuilder) WithPreRunEFunc

func (b *CobraCmdBuilder) WithPreRunEFunc(f func(cmd *cobra.Command, args []string) error) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPreRunEFunc: PreRun but returns an error.

func (*CobraCmdBuilder) WithPreRunFunc

func (b *CobraCmdBuilder) WithPreRunFunc(f func(cmd *cobra.Command, args []string)) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithPreRunFunc: children of this command will not inherit.

func (*CobraCmdBuilder) WithRunEFunc

func (b *CobraCmdBuilder) WithRunEFunc(f func(cmd *cobra.Command, args []string) error) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithRunEFunc: Run but returns an error.

func (*CobraCmdBuilder) WithRunFunc

func (b *CobraCmdBuilder) WithRunFunc(f func(cmd *cobra.Command, args []string)) *CobraCmdBuilder

The *Run functions are executed in the following order:

  • PersistentPreRun()
  • PreRun()
  • Run()
  • PostRun()
  • PersistentPostRun()

All functions get the same args, the arguments after the command name.

WithRunFunc: Typically the actual work function. Most commands will only implement this.

func (*CobraCmdBuilder) WithShortDescription

func (b *CobraCmdBuilder) WithShortDescription(short string) *CobraCmdBuilder

WithShortDescription is the short description shown in the 'help' output.

func (*CobraCmdBuilder) WithStringArrayFlag

func (b *CobraCmdBuilder) WithStringArrayFlag(name string, value []string, usage string) *CobraCmdBuilder

WithStringArrayFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a []string variable that stores the value of the flag. The value of each argument will not try to be separated by comma. Use a StringSlice for that.

func (*CobraCmdBuilder) WithStringArrayPFlag

func (b *CobraCmdBuilder) WithStringArrayPFlag(name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringArrayPFlag is like StringArray, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringArrayPPersistentFlag

func (b *CobraCmdBuilder) WithStringArrayPPersistentFlag(name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringArrayPPersistentFlag is like StringArray, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringArrayPersistentFlag

func (b *CobraCmdBuilder) WithStringArrayPersistentFlag(name string, value []string, usage string) *CobraCmdBuilder

WithStringArrayPersistentFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a []string variable that stores the value of the flag. The value of each argument will not try to be separated by comma. Use a StringSlice for that.

func (*CobraCmdBuilder) WithStringArrayVarFlag

func (b *CobraCmdBuilder) WithStringArrayVarFlag(variable *[]string, name string, value []string, usage string) *CobraCmdBuilder

WithStringArrayVarFlag defines a string flag with specified name, default value, and usage string. The argument p points to a []string variable in which to store the values of the multiple flags. The value of each argument will not try to be separated by comma. Use a StringSlice for that.

func (*CobraCmdBuilder) WithStringArrayVarPFlag

func (b *CobraCmdBuilder) WithStringArrayVarPFlag(variable *[]string, name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringArrayVarPFlag is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringArrayVarPPersistentFlag

func (b *CobraCmdBuilder) WithStringArrayVarPPersistentFlag(variable *[]string, name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringArrayVarPPersistentFlag is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringArrayVarPersistentFlag

func (b *CobraCmdBuilder) WithStringArrayVarPersistentFlag(variable *[]string, name string, value []string, usage string) *CobraCmdBuilder

WithStringArrayVarPersistentFlag defines a string flag with specified name, default value, and usage string. The argument p points to a []string variable in which to store the values of the multiple flags. The value of each argument will not try to be separated by comma. Use a StringSlice for that.

func (*CobraCmdBuilder) WithStringFlag

func (b *CobraCmdBuilder) WithStringFlag(name string, value string, usage string) *CobraCmdBuilder

WithStringFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.

func (*CobraCmdBuilder) WithStringPFlag

func (b *CobraCmdBuilder) WithStringPFlag(name string, shorthand string, value string, usage string) *CobraCmdBuilder

WithStringPFlag is like String, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringPPersistentFlag

func (b *CobraCmdBuilder) WithStringPPersistentFlag(name string, shorthand string, value string, usage string) *CobraCmdBuilder

WithStringPPersistentFlag is like String, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringPersistentFlag

func (b *CobraCmdBuilder) WithStringPersistentFlag(name string, value string, usage string) *CobraCmdBuilder

WithStringPersistentFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.

func (*CobraCmdBuilder) WithStringSliceFlag

func (b *CobraCmdBuilder) WithStringSliceFlag(name string, value []string, usage string) *CobraCmdBuilder

WithStringSliceFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a []string variable that stores the value of the flag. Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. For example:

--ss="v1,v2" --ss="v3"

will result in

[]string{"v1", "v2", "v3"}

func (*CobraCmdBuilder) WithStringSlicePFlag

func (b *CobraCmdBuilder) WithStringSlicePFlag(name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringSlicePFlag is like StringSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringSlicePPersistentFlag

func (b *CobraCmdBuilder) WithStringSlicePPersistentFlag(name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringSlicePPersistentFlag is like StringSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringSlicePersistentFlag

func (b *CobraCmdBuilder) WithStringSlicePersistentFlag(name string, value []string, usage string) *CobraCmdBuilder

WithStringSlicePersistentFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a []string variable that stores the value of the flag. Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. For example:

--ss="v1,v2" --ss="v3"

will result in

[]string{"v1", "v2", "v3"}

func (*CobraCmdBuilder) WithStringSliceVarFlag

func (b *CobraCmdBuilder) WithStringSliceVarFlag(variable *[]string, name string, value []string, usage string) *CobraCmdBuilder

WithStringSliceVarFlag defines a string flag with specified name, default value, and usage string. The argument p points to a []string variable in which to store the value of the flag. Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. For example:

--ss="v1,v2" --ss="v3"

will result in

[]string{"v1", "v2", "v3"}

func (*CobraCmdBuilder) WithStringSliceVarPFlag

func (b *CobraCmdBuilder) WithStringSliceVarPFlag(variable *[]string, name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringSliceVarPFlag is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringSliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithStringSliceVarPPersistentFlag(variable *[]string, name string, shorthand string, value []string, usage string) *CobraCmdBuilder

WithStringSliceVarPPersistentFlag is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringSliceVarPersistentFlag

func (b *CobraCmdBuilder) WithStringSliceVarPersistentFlag(variable *[]string, name string, value []string, usage string) *CobraCmdBuilder

WithStringSliceVarPersistentFlag defines a string flag with specified name, default value, and usage string. The argument p points to a []string variable in which to store the value of the flag. Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. For example:

--ss="v1,v2" --ss="v3"

will result in

[]string{"v1", "v2", "v3"}

func (*CobraCmdBuilder) WithStringToInt64Flag

func (b *CobraCmdBuilder) WithStringToInt64Flag(name string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64Flag defines a string flag with specified name, default value, and usage string. The return value is the address of a map[string ]int64 variable that stores the value of the flag. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringToInt64PFlag

func (b *CobraCmdBuilder) WithStringToInt64PFlag(name string, shorthand string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64PFlag is like StringToInt64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToInt64PPersistentFlag

func (b *CobraCmdBuilder) WithStringToInt64PPersistentFlag(name string, shorthand string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64PPersistentFlag is like StringToInt64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToInt64PersistentFlag

func (b *CobraCmdBuilder) WithStringToInt64PersistentFlag(name string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64PersistentFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a map[string]int64 variable that stores the value of the flag. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringToInt64VarFlag

func (b *CobraCmdBuilder) WithStringToInt64VarFlag(variable *map[string]int64, name string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64VarFlag defines a string flag with specified name, default value, and usage string. The argument p point64s to a map[string]int64 variable in which to store the values of the multiple flags. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringToInt64VarPFlag

func (b *CobraCmdBuilder) WithStringToInt64VarPFlag(variable *map[string]int64, name string, shorthand string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64VarPFlag is like StringToInt64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToInt64VarPPersistentFlag

func (b *CobraCmdBuilder) WithStringToInt64VarPPersistentFlag(variable *map[string]int64, name string, shorthand string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64VarPPersistentFlag is like StringToInt64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToInt64VarPersistentFlag

func (b *CobraCmdBuilder) WithStringToInt64VarPersistentFlag(variable *map[string]int64, name string, value map[string]int64, usage string) *CobraCmdBuilder

WithStringToInt64VarPersistentFlag defines a string flag with specified name, default value, and usage string. The argument p point64s to a map[string]int64 variable in which to store the values of the multiple flags. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringToIntFlag

func (b *CobraCmdBuilder) WithStringToIntFlag(name string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a map[string]int variable that stores the value of the flag. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringToIntPFlag

func (b *CobraCmdBuilder) WithStringToIntPFlag(name string, shorthand string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntPFlag is like StringToInt, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToIntPPersistentFlag

func (b *CobraCmdBuilder) WithStringToIntPPersistentFlag(name string, shorthand string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntPPersistentFlag is like StringToInt, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToIntPersistentFlag

func (b *CobraCmdBuilder) WithStringToIntPersistentFlag(name string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntPersistentFlag defines a string flag with specified name, default value, and usage string. The return value is the address of a map[string]int variable that stores the value of the flag. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringToIntVarFlag

func (b *CobraCmdBuilder) WithStringToIntVarFlag(variable *map[string]int, name string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntVarFlag defines a string flag with specified name, default value, and usage string. The argument p points to a map[string]int variable in which to store the values of the multiple flags. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringToIntVarPFlag

func (b *CobraCmdBuilder) WithStringToIntVarPFlag(variable *map[string]int, name string, shorthand string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntVarPFlag is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToIntVarPPersistentFlag

func (b *CobraCmdBuilder) WithStringToIntVarPPersistentFlag(variable *map[string]int, name string, shorthand string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntVarPPersistentFlag is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringToIntVarPersistentFlag

func (b *CobraCmdBuilder) WithStringToIntVarPersistentFlag(variable *map[string]int, name string, value map[string]int, usage string) *CobraCmdBuilder

WithStringToIntVarPersistentFlag defines a string flag with specified name, default value, and usage string. The argument p points to a map[string]int variable in which to store the values of the multiple flags. The value of each argument will not try to be separated by comma

func (*CobraCmdBuilder) WithStringVarFlag

func (b *CobraCmdBuilder) WithStringVarFlag(variable *string, name string, value string, usage string) *CobraCmdBuilder

WithStringVarFlag defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithStringVarPFlag

func (b *CobraCmdBuilder) WithStringVarPFlag(variable *string, name string, shorthand string, value string, usage string) *CobraCmdBuilder

WithStringVarPFlag is like StringVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringVarPPersistentFlag

func (b *CobraCmdBuilder) WithStringVarPPersistentFlag(variable *string, name string, shorthand string, value string, usage string) *CobraCmdBuilder

WithStringVarPPersistentFlag is like StringVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithStringVarPersistentFlag

func (b *CobraCmdBuilder) WithStringVarPersistentFlag(variable *string, name string, value string, usage string) *CobraCmdBuilder

WithStringVarPersistentFlag defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithSubCommands

func (b *CobraCmdBuilder) WithSubCommands(cmds ...*cobra.Command) *CobraCmdBuilder

WithSubCommands adds one or more commands to this parent command.

func (*CobraCmdBuilder) WithSuggestionsMinimumDistance

func (b *CobraCmdBuilder) WithSuggestionsMinimumDistance(distance int) *CobraCmdBuilder

WithSuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions. Must be > 0.

func (*CobraCmdBuilder) WithUint16Flag

func (b *CobraCmdBuilder) WithUint16Flag(name string, value uint16, usage string) *CobraCmdBuilder

WithUint16Flag defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint16PFlag

func (b *CobraCmdBuilder) WithUint16PFlag(name string, shorthand string, value uint16, usage string) *CobraCmdBuilder

WithUint16PFlag is like Uint16, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint16PPersistentFlag

func (b *CobraCmdBuilder) WithUint16PPersistentFlag(name string, shorthand string, value uint16, usage string) *CobraCmdBuilder

WithUint16PPersistentFlag is like Uint16, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint16PersistentFlag

func (b *CobraCmdBuilder) WithUint16PersistentFlag(name string, value uint16, usage string) *CobraCmdBuilder

WithUint16PersistentFlag defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint16VarFlag

func (b *CobraCmdBuilder) WithUint16VarFlag(variable *uint16, name string, value uint16, usage string) *CobraCmdBuilder

WithUint16VarFlag defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUint16VarPFlag

func (b *CobraCmdBuilder) WithUint16VarPFlag(variable *uint16, name string, shorthand string, value uint16, usage string) *CobraCmdBuilder

WithUint16VarPFlag is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint16VarPPersistentFlag

func (b *CobraCmdBuilder) WithUint16VarPPersistentFlag(variable *uint16, name string, shorthand string, value uint16, usage string) *CobraCmdBuilder

WithUint16VarPPersistentFlag is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint16VarPersistentFlag

func (b *CobraCmdBuilder) WithUint16VarPersistentFlag(variable *uint16, name string, value uint16, usage string) *CobraCmdBuilder

WithUint16VarPersistentFlag defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUint32Flag

func (b *CobraCmdBuilder) WithUint32Flag(name string, value uint32, usage string) *CobraCmdBuilder

WithUint32Flag defines a uint32 flag with specified name, default value, and usage string. The return value is the address of a uint32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint32PFlag

func (b *CobraCmdBuilder) WithUint32PFlag(name string, shorthand string, value uint32, usage string) *CobraCmdBuilder

WithUint32PFlag is like Uint32, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint32PPersistentFlag

func (b *CobraCmdBuilder) WithUint32PPersistentFlag(name string, shorthand string, value uint32, usage string) *CobraCmdBuilder

WithUint32PPersistentFlag is like Uint32, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint32PersistentFlag

func (b *CobraCmdBuilder) WithUint32PersistentFlag(name string, value uint32, usage string) *CobraCmdBuilder

WithUint32PersistentFlag defines a uint32 flag with specified name, default value, and usage string. The return value is the address of a uint32 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint32VarFlag

func (b *CobraCmdBuilder) WithUint32VarFlag(variable *uint32, name string, value uint32, usage string) *CobraCmdBuilder

WithUint32VarFlag defines a uint32 flag with specified name, default value, and usage string. The argument p points to a uint32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUint32VarPFlag

func (b *CobraCmdBuilder) WithUint32VarPFlag(variable *uint32, name string, shorthand string, value uint32, usage string) *CobraCmdBuilder

WithUint32VarPFlag is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint32VarPPersistentFlag

func (b *CobraCmdBuilder) WithUint32VarPPersistentFlag(variable *uint32, name string, shorthand string, value uint32, usage string) *CobraCmdBuilder

WithUint32VarPPersistentFlag is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint32VarPersistentFlag

func (b *CobraCmdBuilder) WithUint32VarPersistentFlag(variable *uint32, name string, value uint32, usage string) *CobraCmdBuilder

WithUint32VarPersistentFlag defines a uint32 flag with specified name, default value, and usage string. The argument p points to a uint32 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUint64Flag

func (b *CobraCmdBuilder) WithUint64Flag(name string, value uint64, usage string) *CobraCmdBuilder

WithUint64Flag defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint64PFlag

func (b *CobraCmdBuilder) WithUint64PFlag(name string, shorthand string, value uint64, usage string) *CobraCmdBuilder

WithUint64PFlag is like Uint64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint64PPersistentFlag

func (b *CobraCmdBuilder) WithUint64PPersistentFlag(name string, shorthand string, value uint64, usage string) *CobraCmdBuilder

WithUint64PPersistentFlag is like Uint64, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint64PersistentFlag

func (b *CobraCmdBuilder) WithUint64PersistentFlag(name string, value uint64, usage string) *CobraCmdBuilder

WithUint64PersistentFlag defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint64VarFlag

func (b *CobraCmdBuilder) WithUint64VarFlag(variable *uint64, name string, value uint64, usage string) *CobraCmdBuilder

WithUint64VarFlag defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUint64VarPFlag

func (b *CobraCmdBuilder) WithUint64VarPFlag(variable *uint64, name string, shorthand string, value uint64, usage string) *CobraCmdBuilder

WithUint64VarPFlag is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint64VarPPersistentFlag

func (b *CobraCmdBuilder) WithUint64VarPPersistentFlag(variable *uint64, name string, shorthand string, value uint64, usage string) *CobraCmdBuilder

WithUint64VarPPersistentFlag is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint64VarPersistentFlag

func (b *CobraCmdBuilder) WithUint64VarPersistentFlag(variable *uint64, name string, value uint64, usage string) *CobraCmdBuilder

WithUint64VarPersistentFlag defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUint8Flag

func (b *CobraCmdBuilder) WithUint8Flag(name string, value uint8, usage string) *CobraCmdBuilder

WithUint8Flag defines a uint8 flag with specified name, default value, and usage string. The return value is the address of a uint8 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint8PFlag

func (b *CobraCmdBuilder) WithUint8PFlag(name string, shorthand string, value uint8, usage string) *CobraCmdBuilder

WithUint8PFlag is like Uint8, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint8PPersistentFlag

func (b *CobraCmdBuilder) WithUint8PPersistentFlag(name string, shorthand string, value uint8, usage string) *CobraCmdBuilder

WithUint8PPersistentFlag is like Uint8, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint8PersistentFlag

func (b *CobraCmdBuilder) WithUint8PersistentFlag(name string, value uint8, usage string) *CobraCmdBuilder

WithUint8PersistentFlag defines a uint8 flag with specified name, default value, and usage string. The return value is the address of a uint8 variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUint8VarFlag

func (b *CobraCmdBuilder) WithUint8VarFlag(variable *uint8, name string, value uint8, usage string) *CobraCmdBuilder

WithUint8VarFlag defines a uint8 flag with specified name, default value, and usage string. The argument p points to a uint8 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUint8VarPFlag

func (b *CobraCmdBuilder) WithUint8VarPFlag(variable *uint8, name string, shorthand string, value uint8, usage string) *CobraCmdBuilder

WithUint8VarPFlag is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint8VarPPersistentFlag

func (b *CobraCmdBuilder) WithUint8VarPPersistentFlag(variable *uint8, name string, shorthand string, value uint8, usage string) *CobraCmdBuilder

WithUint8VarPPersistentFlag is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUint8VarPersistentFlag

func (b *CobraCmdBuilder) WithUint8VarPersistentFlag(variable *uint8, name string, value uint8, usage string) *CobraCmdBuilder

WithUint8VarPersistentFlag defines a uint8 flag with specified name, default value, and usage string. The argument p points to a uint8 variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUintFlag

func (b *CobraCmdBuilder) WithUintFlag(name string, value uint, usage string) *CobraCmdBuilder

WithUintFlag defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUintPFlag

func (b *CobraCmdBuilder) WithUintPFlag(name string, shorthand string, value uint, usage string) *CobraCmdBuilder

WithIntPFlag is like Uint, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintPPersistentFlag

func (b *CobraCmdBuilder) WithUintPPersistentFlag(name string, shorthand string, value uint, usage string) *CobraCmdBuilder

WithIntPPersistentFlag is like Uint, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintPersistentFlag

func (b *CobraCmdBuilder) WithUintPersistentFlag(name string, value uint, usage string) *CobraCmdBuilder

WithUintPersistentFlag defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUintSliceFlag

func (b *CobraCmdBuilder) WithUintSliceFlag(name string, value []uint, usage string) *CobraCmdBuilder

WithUintSliceFlag defines a []uint flag with specified name, default value, and usage string. The return value is the address of a []uint variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUintSlicePFlag

func (b *CobraCmdBuilder) WithUintSlicePFlag(name string, shorthand string, value []uint, usage string) *CobraCmdBuilder

WithUintSlicePFlag is like UintSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintSlicePPersistentFlag

func (b *CobraCmdBuilder) WithUintSlicePPersistentFlag(name string, shorthand string, value []uint, usage string) *CobraCmdBuilder

WithUintSlicePPersistentFlag is like UintSlice, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintSlicePersistentFlag

func (b *CobraCmdBuilder) WithUintSlicePersistentFlag(name string, value []uint, usage string) *CobraCmdBuilder

WithUintSlicePersistentFlag defines a []uint flag with specified name, default value, and usage string. The return value is the address of a []uint variable that stores the value of the flag.

func (*CobraCmdBuilder) WithUintSliceVarFlag

func (b *CobraCmdBuilder) WithUintSliceVarFlag(variable *[]uint, name string, value []uint, usage string) *CobraCmdBuilder

WithUintSliceVarFlag defines a uintSlice flag with specified name, default value, and usage string. The argument p points to a []uint variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUintSliceVarPFlag

func (b *CobraCmdBuilder) WithUintSliceVarPFlag(variable *[]uint, name string, shorthand string, value []uint, usage string) *CobraCmdBuilder

WithUintSliceVarPFlag is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintSliceVarPPersistentFlag

func (b *CobraCmdBuilder) WithUintSliceVarPPersistentFlag(variable *[]uint, name string, shorthand string, value []uint, usage string) *CobraCmdBuilder

WithUintSliceVarPPersistentFlag is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintSliceVarPersistentFlag

func (b *CobraCmdBuilder) WithUintSliceVarPersistentFlag(variable *[]uint, name string, value []uint, usage string) *CobraCmdBuilder

WithUintSliceVarPersistentFlag defines a uintSlice flag with specified name, default value, and usage string. The argument p points to a []uint variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUintVarFlag

func (b *CobraCmdBuilder) WithUintVarFlag(variable *uint, name string, value uint, usage string) *CobraCmdBuilder

WithUintVarFlag defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUintVarPFlag

func (b *CobraCmdBuilder) WithUintVarPFlag(variable *uint, name string, shorthand string, value uint, usage string) *CobraCmdBuilder

WithUintVarPFlag is like UintVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintVarPPersistentFlag

func (b *CobraCmdBuilder) WithUintVarPPersistentFlag(variable *uint, name string, shorthand string, value uint, usage string) *CobraCmdBuilder

WithUintVarPPersistentFlag is like UintVar, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithUintVarPersistentFlag

func (b *CobraCmdBuilder) WithUintVarPersistentFlag(variable *uint, name string, value uint, usage string) *CobraCmdBuilder

WithUintVarPersistentFlag defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.

func (*CobraCmdBuilder) WithUsageFunc

func (b *CobraCmdBuilder) WithUsageFunc(function func(*cobra.Command) error) *CobraCmdBuilder

WithUsageFunc sets usage function. Usage can be defined by application.

func (*CobraCmdBuilder) WithUsageTemplate

func (b *CobraCmdBuilder) WithUsageTemplate(template string) *CobraCmdBuilder

WithUsageTemplate sets usage template. Can be defined by Application.

func (*CobraCmdBuilder) WithValidArgs

func (b *CobraCmdBuilder) WithValidArgs(validArgs []string) *CobraCmdBuilder

WithValidArgs is list of all valid non-flag arguments that are accepted in shell completions

func (*CobraCmdBuilder) WithValidArgsFunction

func (b *CobraCmdBuilder) WithValidArgsFunction(validArgsFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)) *CobraCmdBuilder

WithValidArgsFunction is an optional function that provides valid non-flag arguments for shell completion. It is a dynamic version of using ValidArgs. Only one of ValidArgs and ValidArgsFunction can be used for a command.

func (*CobraCmdBuilder) WithVarFlag

func (b *CobraCmdBuilder) WithVarFlag(value pflag.Value, name string, usage string) *CobraCmdBuilder

WithVarFlag defines a flag with the specified name and usage string. The type and value of the flag are represented by the first argument, of type Value, which typically holds a user-defined implementation of Value. For instance, the caller could create a flag that turns a comma-separated string into a slice of strings by giving the slice the methods of Value; in particular, Set would decompose the comma-separated string into the slice.

func (*CobraCmdBuilder) WithVarPFlag

func (b *CobraCmdBuilder) WithVarPFlag(value pflag.Value, name string, shorthand string, usage string) *CobraCmdBuilder

WithVarPFlag is like Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithVarPPersistentFlag

func (b *CobraCmdBuilder) WithVarPPersistentFlag(value pflag.Value, name string, shorthand string, usage string) *CobraCmdBuilder

WithVarPPersistentFlag is like Var, but accepts a shorthand letter that can be used after a single dash.

func (*CobraCmdBuilder) WithVarPersistentFlag

func (b *CobraCmdBuilder) WithVarPersistentFlag(value pflag.Value, name string, usage string) *CobraCmdBuilder

WithVarPersistentFlag defines a flag with the specified name and usage string. The type and value of the flag are represented by the first argument, of type Value, which typically holds a user-defined implementation of Value. For instance, the caller could create a flag that turns a comma-separated string into a slice of strings by giving the slice the methods of Value; in particular, Set would decompose the comma-separated string into the slice.

func (*CobraCmdBuilder) WithVersion

func (b *CobraCmdBuilder) WithVersion(version string) *CobraCmdBuilder

Version defines the version for this command. If this value is non-empty and the command does not define a "version" flag, a "version" boolean flag will be added to the command and, if specified, will print content of the "Version" variable. A shorthand "v" flag will also be added if the command does not define one.

type Command

type Command struct {
	*cobra.Command
	Opts     []Option
	Profiles []Profile
}

Command is a wrapper for the cobra Command that adds additional fields to support better usage, help, etc.

func (Command) HasOptions

func (c Command) HasOptions() bool

HasOptions returns whether the boa Command has any options defined; this is primary used for templating purposes.

func (Command) HasProfiles added in v0.2.0

func (c Command) HasProfiles() bool

HasProfiles returns whether the boa Command has any profiles defined; this is primary used for templating purposes.

func (Command) HelpFunc

func (c Command) HelpFunc(template string) func(*cobra.Command, []string)

HelpFunc overrides the default HelpFunc used by cobra to facilitate showing a custom help template

func (Command) OptionsTemplate

func (c Command) OptionsTemplate() string

OptionsTemplate is used to override the cobra UsageTemplate to facilitate options and other CLI parameters

func (Command) ToBuilder

func (b Command) ToBuilder() *BoaCmdBuilder

Build returns a boa Command from a BoaCmdBuilder

func (Command) UsageFunc

func (c Command) UsageFunc(template string) func(*cobra.Command) error

UsageFunc overrides the default UsageFunc used by boa to facilitate showing a custom usage template

type Option

type Option struct {
	Args []string
	Desc string
}

Option is used to define multiple positional args in which the positional args can have a description. Aliases for the args can be added to the Args slice.

type Profile added in v0.2.0

type Profile struct {
	Args []string
	Opts []string
	Desc string
}

Profile is used to bundle multiple options as a single option

type ViperCfgBuilder

type ViperCfgBuilder struct {
	// contains filtered or unexported fields
}

ViperCfgBuilder is a builder that wraps viper.Viper objects to allow more fluently defining configuration.

func NewDefaultViperCfg

func NewDefaultViperCfg(name string) *ViperCfgBuilder

NewDefaultViperCfg initializes a new viper instance with default configuration and returns a builder. It adds the user's current working directory and XDG_CONFIG_HOME to the searchable config path in that respective order and searches for configuration files of 'name' and any extension.

func NewViperCfg

func NewViperCfg() *ViperCfgBuilder

NewViperCfg initializes a new viper instance and returns a builder.

func ToViperCfgBuilder

func ToViperCfgBuilder(cmd *viper.Viper) *ViperCfgBuilder

ToViperCfgBuilder is used to convert a viper.Viper object to a ViperCfgBuilder

func (*ViperCfgBuilder) Build

func (b *ViperCfgBuilder) Build() *viper.Viper

Build returns a viper.Viper object from a ViperCfgBuilder

func (*ViperCfgBuilder) ReadConfig

func (b *ViperCfgBuilder) ReadConfig(in io.Reader) *ViperCfgBuilder

ReadConfig will read a configuration file, setting existing keys to nil if the key does not exist in the file.

If an error is encountered, logs fatal

func (*ViperCfgBuilder) ReadInConfig

func (b *ViperCfgBuilder) ReadInConfig() *ViperCfgBuilder

ReadInConfig will discover and load the configuration file from disk and key/value stores, searching in one of the defined paths.

If an error is encountered, logs fatal

func (*ViperCfgBuilder) ReadInConfigAndBuild

func (b *ViperCfgBuilder) ReadInConfigAndBuild() *viper.Viper

ReadAndBuild will read in the config based on configured file/path/name/type and return a viper.Viper object from a ViperCfgBuilder.

If an error is encountered, logs fatal

func (*ViperCfgBuilder) WithAutomaticEnv

func (b *ViperCfgBuilder) WithAutomaticEnv() *ViperCfgBuilder

WithAutomaticEnv makes Viper check if environment variables match any of the existing keys (config, default or flags). If matching env vars are found, they are loaded into Viper.

func (*ViperCfgBuilder) WithBoundEnv

func (b *ViperCfgBuilder) WithBoundEnv(input ...string) *ViperCfgBuilder

WithBoundEnv binds a Viper key to a ENV variable. ENV variables are case sensitive. If only a key is provided, it will use the env key matching the key, uppercased. If more arguments are provided, they will represent the env variable names that should bind to this key and will be taken in the specified order. EnvPrefix will be used when set when env name is not provided.

func (*ViperCfgBuilder) WithConfigFiles

func (b *ViperCfgBuilder) WithConfigFiles(files ...string) *ViperCfgBuilder

WithConfigFiles takes a variable number of filepaths to check for viper configuration. The order of the files passed is the order of precedence given to each filepath.

func (*ViperCfgBuilder) WithConfigName

func (b *ViperCfgBuilder) WithConfigName(name string) *ViperCfgBuilder

WithConfigName sets the config name to search for in the configured paths.

func (*ViperCfgBuilder) WithConfigPaths

func (b *ViperCfgBuilder) WithConfigPaths(paths ...string) *ViperCfgBuilder

WithConfigPaths adds a variable number of paths for Viper to search for the config file in. It will only add the path if it exists.

func (*ViperCfgBuilder) WithConfigType

func (b *ViperCfgBuilder) WithConfigType(ext string) *ViperCfgBuilder

WithConfigType sets the file extension type to search for on config files. e.g. "json"

func (*ViperCfgBuilder) WithDefaultEnvKeyReplacer

func (b *ViperCfgBuilder) WithDefaultEnvKeyReplacer() *ViperCfgBuilder

WithDefaultEnvKeyReplacer is commonly used to convert underscore delimited environment variables to their dot delimited equivalents.

For example, the env var COMMAND_NAME can be referenced through Viper as viper.Get("command.name")

func (*ViperCfgBuilder) WithEnvKeyReplacer

func (b *ViperCfgBuilder) WithEnvKeyReplacer(replacer *strings.Replacer) *ViperCfgBuilder

WithEnvKeyReplacer sets the strings.Replacer on the viper object Useful for mapping an environmental variable to a key that does not match it.

func (*ViperCfgBuilder) WithEnvPrefix

func (b *ViperCfgBuilder) WithEnvPrefix(prefix string) *ViperCfgBuilder

WithEnvPrefix sets the prefix to use for subsequent bound env vars.

Jump to

Keyboard shortcuts

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