Documentation ¶
Index ¶
- func ExtractFlagBool(args []string, name string) (bool, []string, bool)
- func ExtractFlagString(args []string, name string) (string, []string, bool)
- func GetFlagBool(args []string, name string) bool
- func GetFlagString(args []string, name string) (string, bool)
- func GetFlagValue(args []string, name string, isBool bool) (string, []int, bool)
- func ParseFlagSetSets(fs *flag.FlagSet, args []string, isBool map[string]bool) (unknownArgs, unnamedArgs, execArgs []string, _ error)
- type Arg
- type BoolFuncFlag
- type ParsedArgs
- func (pa ParsedArgs) CommonSplit() (ParsedArgs, ParsedArgs, ParsedArgs)
- func (pa ParsedArgs) Get(name string) (*Arg, bool)
- func (pa ParsedArgs) Join() []string
- func (pa *ParsedArgs) Remove(arg *Arg)
- func (pa ParsedArgs) SplitAtDoubleDashExclude() (ParsedArgs, ParsedArgs)
- func (pa ParsedArgs) SplitAtFirstNamed() (ParsedArgs, ParsedArgs)
- func (pa ParsedArgs) SplitAtFirstUnnamed() (ParsedArgs, ParsedArgs)
- func (pa ParsedArgs) SplitAtNameExclude(name string) (ParsedArgs, ParsedArgs)
- type StringFuncFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractFlagString ¶
func GetFlagBool ¶
func GetFlagValue ¶
func ParseFlagSetSets ¶
func ParseFlagSetSets(fs *flag.FlagSet, args []string, isBool map[string]bool) (unknownArgs, unnamedArgs, execArgs []string, _ error)
usefull to allow unknown flags to be collected, to possibly pass them to another program. The main issue is knowning which unknown flags are boolean that won't receive a value after space (ex: -mybool main.go, main.go is not an arg to mybool). In this case, the provided map allows to correct this without having to define the flags in the flagset.
Types ¶
type Arg ¶
type BoolFuncFlag ¶
func (BoolFuncFlag) IsBoolFlag ¶
func (v BoolFuncFlag) IsBoolFlag() bool
func (BoolFuncFlag) Set ¶
func (v BoolFuncFlag) Set(s string) error
func (BoolFuncFlag) String ¶
func (v BoolFuncFlag) String() string
type ParsedArgs ¶
type ParsedArgs []*Arg
func ParseParsedArgs ¶
func ParseParsedArgs(args []string, isBool map[string]bool) ParsedArgs
func (ParsedArgs) CommonSplit ¶
func (pa ParsedArgs) CommonSplit() (ParsedArgs, ParsedArgs, ParsedArgs)
func (ParsedArgs) Join ¶
func (pa ParsedArgs) Join() []string
func (*ParsedArgs) Remove ¶
func (pa *ParsedArgs) Remove(arg *Arg)
func (ParsedArgs) SplitAtDoubleDashExclude ¶
func (pa ParsedArgs) SplitAtDoubleDashExclude() (ParsedArgs, ParsedArgs)
func (ParsedArgs) SplitAtFirstNamed ¶
func (pa ParsedArgs) SplitAtFirstNamed() (ParsedArgs, ParsedArgs)
func (ParsedArgs) SplitAtFirstUnnamed ¶
func (pa ParsedArgs) SplitAtFirstUnnamed() (ParsedArgs, ParsedArgs)
func (ParsedArgs) SplitAtNameExclude ¶
func (pa ParsedArgs) SplitAtNameExclude(name string) (ParsedArgs, ParsedArgs)
type StringFuncFlag ¶
func (StringFuncFlag) Set ¶
func (v StringFuncFlag) Set(s string) error
func (StringFuncFlag) String ¶
func (v StringFuncFlag) String() string
Click to show internal directories.
Click to hide internal directories.