Documentation ¶
Overview ¶
Package opt implements command-line flag parsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
A Set represents a set of defined options.
func (*Set) Arg ¶
Arg defines a simple option with an argument, e.g. `-I foo` or `-I=foo`. Setting imm argument enables additionally `-Ifoo`. When the option is found during Parse, the handler is called with the values of the option and the argument, e.g. "-I" and "foo" for all of the variants.
func (*Set) Opt ¶
Opt defines a simple option, e.g. `-f`. When the option is found during Parse, the handler is called with the value of the option, e.g. "-f".
func (*Set) Parse ¶
Parse parses opts. Must be called after all options are defined. The handler is called for all items in opts that were not defined before using Opt or Arg.
If any handler returns a non-nil error, Parse will stop. If the error is of type Skip, the error returned by Parse will contain all the unprocessed items of opts.
The opts slice must not be modified by any handler while Parser is executing.