Documentation
¶
Overview ¶
Package argv reads another program's argument vector without knowing that program's option table: whether a POSIX short flag or a GNU long option is present, the way getopt and getopt_long would see it.
It is a pure library. It starts no goroutines and crosses no boundary.
Knowing no option table has one limit, and it is the price of reading any program: a value is indistinguishable from a flag. In "-ofile" where -o takes a value, the bundle is read as -o -f -i -l -e; in "-p -f" where -p takes a value, "-f" is read as a flag. A caller that must be exact for one program parses with that program's table instead.
Index ¶
Constants ¶
const (
// Terminator ends the options: every argument after it is an operand.
Terminator = "--"
)
The spellings getopt_long gives special meaning to.
Variables ¶
This section is empty.
Functions ¶
func HasFlag ¶
HasFlag reports whether arguments carry flag before the terminator: the short form alone (-f) or bundled with other short flags (-af, -fl), or the long form alone (--full) or with an attached value (--full=yes). A zero Flag matches nothing; "-" alone is an operand (standard input), not a flag.