Documentation
¶
Overview ¶
Package command implements generic nested command parsing.
Index ¶
Constants ¶
View Source
const UsageInternal = "internal"
UsageInternal causes the command to be hidden from help text when set as the usage string.
Variables ¶
View Source
var ( ErrEmptyTree = errors.New("subcommand tree has no nodes") ErrNoMatch = errors.New("did not match any subcommand") )
View Source
var ErrHelp = errors.New("help requested")
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Flag ¶
type Flag[T any] interface { // Flag defines a generic flag type in Node's flag set. Flag(p any, name string, value FlagDefiner, usage string) T }
type FlagDefiner ¶
type FlagDefiner interface {
// Define defines the flag in set.
Define(b *strings.Builder, set *flag.FlagSet, p any, name, usage string)
}
FlagDefiner is a deferred flag definer value, usually encapsulating the default value.
type FlagError ¶
type FlagError struct {
// contains filtered or unexported fields
}
FlagError wraps errors returned by flag.
type HandlerFunc ¶
HandlerFunc is called when matching a directly handled subcommand tree.
type RepeatableFlag ¶
type RepeatableFlag []string
RepeatableFlag implements an ordered, repeatable string flag.
func (*RepeatableFlag) Set ¶
func (r *RepeatableFlag) Set(v string) error
func (*RepeatableFlag) String ¶
func (r *RepeatableFlag) String() string
Click to show internal directories.
Click to hide internal directories.