Documentation ¶
Index ¶
- Variables
- func Execute(version, commit, buildTime string)
- func Must(err error)
- func Perform(action string, fn func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string)
- type FlagBuilder
- func (fb *FlagBuilder) AddCommand(command *cobra.Command) *FlagBuilder
- func (fb *FlagBuilder) Bind(key string) *FlagBuilder
- func (fb *FlagBuilder) Bool(key string, defaultValue bool, description string) *FlagBuilder
- func (fb *FlagBuilder) BoolP(key string, shortKey string, defaultValue bool, description string) *FlagBuilder
- func (fb *FlagBuilder) Concat(builders ...*FlagBuilder) *FlagBuilder
- func (fb *FlagBuilder) Duration(key string, defaultValue time.Duration, description string) *FlagBuilder
- func (fb *FlagBuilder) Env(env string) *FlagBuilder
- func (fb *FlagBuilder) Flag() *FlagBuilder
- func (fb *FlagBuilder) Float64(key string, defaultValue float64, description string) *FlagBuilder
- func (fb *FlagBuilder) Int(key string, defaultValue int, description string) *FlagBuilder
- func (fb *FlagBuilder) Require() *FlagBuilder
- func (fb *FlagBuilder) SetKey(key string) *FlagBuilder
- func (fb *FlagBuilder) String(key string, defaultValue string, description string) *FlagBuilder
- func (fb *FlagBuilder) StringSlice(key string, defaultValue []string, description string) *FlagBuilder
- func (fb *FlagBuilder) Uint(key string, defaultValue uint, description string) *FlagBuilder
Constants ¶
This section is empty.
Variables ¶
var ( // RootCmd is the base command (what the binary is called) RootCmd = &cobra.Command{ Use: "bat-go", Short: "bat-go provides go based services and processes for BAT", } )
var VersionCmd = &cobra.Command{
Use: "version",
Short: "get the version of this binary",
Run: versionRun,
}
VersionCmd is the command to get the code's version information
Functions ¶
Types ¶
type FlagBuilder ¶
type FlagBuilder struct {
// contains filtered or unexported fields
}
FlagBuilder creates a flag builder
func NewFlagBuilder ¶
func NewFlagBuilder(command *cobra.Command) *FlagBuilder
NewFlagBuilder creates a new FlagBuilder from one command
func (*FlagBuilder) AddCommand ¶
func (fb *FlagBuilder) AddCommand(command *cobra.Command) *FlagBuilder
AddCommand adds a command
func (*FlagBuilder) Bind ¶
func (fb *FlagBuilder) Bind(key string) *FlagBuilder
Bind runs the BindPFlag function
func (*FlagBuilder) Bool ¶
func (fb *FlagBuilder) Bool(key string, defaultValue bool, description string) *FlagBuilder
Bool attaches a bool flag to the command
func (*FlagBuilder) BoolP ¶
func (fb *FlagBuilder) BoolP(key string, shortKey string, defaultValue bool, description string) *FlagBuilder
BoolP attaches a boolean flag to the command
func (*FlagBuilder) Concat ¶
func (fb *FlagBuilder) Concat(builders ...*FlagBuilder) *FlagBuilder
Concat combine flag builders
func (*FlagBuilder) Duration ¶
func (fb *FlagBuilder) Duration(key string, defaultValue time.Duration, description string) *FlagBuilder
Duration attaches a string flag to the command
func (*FlagBuilder) Flag ¶
func (fb *FlagBuilder) Flag() *FlagBuilder
Flag resets the builder to allow for chaining
func (*FlagBuilder) Float64 ¶
func (fb *FlagBuilder) Float64(key string, defaultValue float64, description string) *FlagBuilder
Float64 attaches a float64 type flag to the command
func (*FlagBuilder) Int ¶
func (fb *FlagBuilder) Int(key string, defaultValue int, description string) *FlagBuilder
Int attaches an int flag to the command
func (*FlagBuilder) Require ¶
func (fb *FlagBuilder) Require() *FlagBuilder
Require requires the flag
func (*FlagBuilder) SetKey ¶
func (fb *FlagBuilder) SetKey(key string) *FlagBuilder
SetKey sets the key to be shared across methods
func (*FlagBuilder) String ¶
func (fb *FlagBuilder) String(key string, defaultValue string, description string) *FlagBuilder
String attaches a string flag to the command
func (*FlagBuilder) StringSlice ¶
func (fb *FlagBuilder) StringSlice(key string, defaultValue []string, description string) *FlagBuilder
StringSlice attaches a string slice flag to the command
func (*FlagBuilder) Uint ¶
func (fb *FlagBuilder) Uint(key string, defaultValue uint, description string) *FlagBuilder
Uint attaches an uint flag to the command