# README
Package mflag (aka multiple-flag) implements command-line flag parsing.
It's an hacky fork of the official golang package
It adds:
-
both short and long flag version
./example -s red
./example --string blue
-
multiple names for the same option
$>./example -h
Usage of example:
-s, --string="": a simple string
It is very flexible on purpose, so you can do things like:
$>./example -h
Usage of example:
-s, -string, --string="": a simple string
Or:
$>./example -h
Usage of example:
-oldflag, --newflag="": a simple string
You can also hide some flags from the usage, so if we want only --newflag
:
$>./example -h
Usage of example:
--newflag="": a simple string
$>./example -oldflag str
str
See example.go for more details.
# Packages
No description provided by the author
# Functions
Arg returns the i'th command-line argument.
Args returns the non-flag command-line arguments.
Bool defines a bool flag with specified name, default value, and usage string.
BoolVar defines a bool flag with specified name, default value, and usage string.
Duration defines a time.Duration flag with specified name, default value, and usage string.
DurationVar defines a time.Duration flag with specified name, default value, and usage string.
Float64 defines a float64 flag with specified name, default value, and usage string.
Float64Var defines a float64 flag with specified name, default value, and usage string.
Int defines an int flag with specified name, default value, and usage string.
Int64 defines an int64 flag with specified name, default value, and usage string.
Int64Var defines an int64 flag with specified name, default value, and usage string.
IntVar defines an int flag with specified name, default value, and usage string.
Lookup returns the Flag structure of the named command-line flag, returning nil if none exists.
NArg is the number of arguments remaining after flags have been processed.
NewFlagSet returns a new, empty flag set with the specified name and error handling property.
NFlag returns the number of command-line flags that have been set.
Parse parses the command-line flags from os.Args[1:].
Parsed returns true if the command-line flags have been parsed.
PrintDefaults prints to standard error the default values of all defined command-line flags.
Set sets the value of the named command-line flag.
String defines a string flag with specified name, default value, and usage string.
StringVar defines a string flag with specified name, default value, and usage string.
Uint defines a uint flag with specified name, default value, and usage string.
Uint64 defines a uint64 flag with specified name, default value, and usage string.
Uint64Var defines a uint64 flag with specified name, default value, and usage string.
UintVar defines a uint flag with specified name, default value, and usage string.
Var defines a flag with the specified name and usage string.
Visit visits the command-line flags in lexicographical order, calling fn for each.
VisitAll visits the command-line flags in lexicographical order, calling fn for each.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
CommandLine is the default set of command-line flags, parsed from os.Args.
ErrHelp is the error returned if the flag -help is invoked but no such flag is defined.
ErrRetry is the error returned if you need to try letter by letter.
Usage prints to standard error a usage message documenting all defined command-line flags.
# Type aliases
ErrorHandling defines how to handle flag parsing errors.