Documentation ¶
Index ¶
- Variables
- func Parse(ctx context.Context, flags *flag.FlagSet, opts ...ParseOption) (err error)
- func PrintDefaults(ctx context.Context, flags *flag.FlagSet, opts ...ParseOption) error
- func Subset(super *flag.FlagSet, prefix string, setup func(sub *flag.FlagSet)) (err error)
- type ParseOption
- type ParseOptionFunc
- type Parser
- type ParserFunc
- type ParserOption
- type ParserOptionFunc
- type Printer
- type PrinterFunc
- type UnquoteUsageMode
Constants ¶
This section is empty.
Variables ¶
View Source
var SetSeparator = "."
Functions ¶
func PrintDefaults ¶ added in v0.3.0
PrintDefaults prints parsers aware usage message to flags.Output().
Types ¶
type ParseOption ¶
type ParseOption interface {
// contains filtered or unexported methods
}
type ParseOptionFunc ¶ added in v0.4.0
type ParseOptionFunc func(*config)
func WithCustomUsage ¶ added in v0.4.0
func WithCustomUsage() ParseOptionFunc
WithCustomUsage makes Parse() to ignore flag.FlagSet.Usage field when receiving flag.ErrHelp error from some parser and print results of flagutil.PrintDefaults() instead.
func WithIgnoreUndefined ¶
func WithIgnoreUndefined() ParseOptionFunc
WithIgnoreUndefined makes Parse() to not fail on setting undefined flag.
func WithParseOptions ¶ added in v0.5.0
func WithParseOptions(opts ...ParseOption) ParseOptionFunc
func WithParser ¶
func WithParser(p Parser, opts ...ParserOption) ParseOptionFunc
WithParser returns a parse option and makes p to be used during Parse().
func WithUnquoteUsageMode ¶ added in v0.3.0
func WithUnquoteUsageMode(m UnquoteUsageMode) ParseOptionFunc
type ParserFunc ¶ added in v0.3.0
type ParserOption ¶ added in v0.3.0
type ParserOption interface {
// contains filtered or unexported methods
}
type ParserOptionFunc ¶ added in v0.4.0
type ParserOptionFunc func(*config, *parser)
func WithStashName ¶ added in v0.4.0
func WithStashName(name string) ParserOptionFunc
func WithStashPrefix ¶ added in v0.4.0
func WithStashPrefix(prefix string) ParserOptionFunc
func WithStashRegexp ¶ added in v0.4.0
func WithStashRegexp(re *regexp.Regexp) ParserOptionFunc
type PrinterFunc ¶ added in v0.3.0
type UnquoteUsageMode ¶ added in v0.3.0
type UnquoteUsageMode uint8
const ( UnquoteNothing UnquoteUsageMode = 1 << iota >> 1 UnquoteQuoted UnquoteInferType UnquoteClean UnquoteDefault UnquoteUsageMode = UnquoteQuoted | UnquoteInferType )
func (UnquoteUsageMode) String ¶ added in v0.3.0
func (m UnquoteUsageMode) String() string
Click to show internal directories.
Click to hide internal directories.