Documentation ¶
Overview ¶
Package 'eflag' is a wrapper around Go's standard flag, it provides enhancments for: Adding Header and Footer's to Usage. Adding Aliases to flags. (ie.. -d, --debug) Enhances formatting for flag usage. Aside from that everything else is standard from the flag library.
Index ¶
- Variables
- func Footer(input string)
- func Header(input string)
- func Parse() (err error)
- func Usage()
- type EFlagSet
- func (s *EFlagSet) Args() []string
- func (E *EFlagSet) Bool(name string, usage string) *bool
- func (E *EFlagSet) BoolVar(p *bool, name string, usage string)
- func (E *EFlagSet) InlineArgs(name ...string)
- func (s *EFlagSet) IsSet(name string) bool
- func (E *EFlagSet) Multi(name string, value string, usage string) *[]string
- func (E *EFlagSet) MultiVar(p *[]string, name string, value string, usage string)
- func (s *EFlagSet) Order(name ...string)
- func (s *EFlagSet) Parse(args []string) (err error)
- func (s *EFlagSet) PrintDefaults()
- func (s *EFlagSet) ResolveAlias(name string) string
- func (s *EFlagSet) SetOutput(output io.Writer)
- func (s *EFlagSet) Shorten(name string, ch rune)
- func (E *EFlagSet) SyntaxName(name string)
- func (s *EFlagSet) VisitAll(fn func(*Flag))
- type ErrorHandling
- type Flag
Constants ¶
This section is empty.
Variables ¶
var ( InlineArgs = cmd.InlineArgs SyntaxName = cmd.SyntaxName SetOutput = cmd.SetOutput PrintDefaults = cmd.PrintDefaults Shorten = cmd.Shorten String = cmd.String StringVar = cmd.StringVar Arg = cmd.Arg Args = cmd.Args Bool = cmd.Bool BoolVar = cmd.BoolVar Duration = cmd.Duration DurationVar = cmd.DurationVar Float64 = cmd.Float64 Float64Var = cmd.Float64Var Int = cmd.Int IntVar = cmd.IntVar Int64 = cmd.Int64 Int64Var = cmd.Int64Var Lookup = cmd.Lookup Multi = cmd.Multi MultiVar = cmd.MultiVar NArg = cmd.NArg NFlag = cmd.NFlag Name = cmd.Name Output = cmd.Output Parsed = cmd.Parsed Uint = cmd.Uint UintVar = cmd.UintVar Uint64 = cmd.Uint64 Uint64Var = cmd.Uint64Var Var = cmd.Var Visit = cmd.Visit VisitAll = cmd.VisitAll )
var ErrHelp = flag.ErrHelp
Functions ¶
Types ¶
type EFlagSet ¶
type EFlagSet struct { Header string // Header presented at start of help. AdaptArgs bool // Reorders flags and arguments so flags come first, non-flag arguments second, unescapes arguments with '\' escape character. ShowSyntax bool // Display Usage: line, InlineArgs will automatically display usage info. *flag.FlagSet // contains filtered or unexported fields }
A EFlagSet is a set of defined flags.
func NewFlagSet ¶
func NewFlagSet(name string, errorHandling ErrorHandling) (output *EFlagSet)
Load a flag created with flag package.
func (*EFlagSet) Bool ¶
Bool defines a bool flag with specified name, default and usage string. The return value is the address of a bool variable that stores the value of the flag.
func (*EFlagSet) BoolVar ¶
BoolVar defines a bool flag with specified name, and usage string. The argument p points to a bool variable in which to store the value of the flag.
func (*EFlagSet) InlineArgs ¶
Maps flags as inline arguments.
func (*EFlagSet) PrintDefaults ¶
func (s *EFlagSet) PrintDefaults()
Reads through all flags available and outputs with better formatting.
func (*EFlagSet) ResolveAlias ¶
Resolves Alias name to fullname
func (*EFlagSet) SyntaxName ¶
Specifies the name that will be shown for the usage/syntax.
type ErrorHandling ¶
type ErrorHandling int
Duplicate flag's ErrorHandling.
const ( ContinueOnError ErrorHandling = iota ExitOnError PanicOnError ReturnErrorOnly )