Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoNothing ¶
func DoNothing(_ flag.PassedFlags) error
DoNothing is a command action that simply returns nil Useful for prototyping
Types ¶
type Command ¶
type Command struct { Action Action Flags flag.FlagMap // HelpShort is a required one-line description HelpShort HelpShort Footer string // HelpLong is an optional longer description HelpLong string }
A Command will run code for you! The name of a Command should probably be a verb - add , edit, run, ... A Command should not be constructed directly. Use Command / New / ExistingCommand functions
type CommandMap ¶
A CommandMap holds Commands and is used by Sections
func (CommandMap) Empty ¶ added in v0.0.13
func (fm CommandMap) Empty() bool
func (CommandMap) SortedNames ¶ added in v0.0.13
func (fm CommandMap) SortedNames() []Name
type CommandOpt ¶
type CommandOpt func(*Command)
A CommandOpt customizes a Command
func ExistingFlag ¶
func ExistingFlag(name flag.Name, value flag.Flag) CommandOpt
ExistingFlag adds an existing flag to a Command. It panics if a flag with the same name exists
func ExistingFlags ¶
func ExistingFlags(flagMap flag.FlagMap) CommandOpt
func Flag ¶
func Flag(name flag.Name, helpShort flag.HelpShort, empty value.EmptyConstructor, opts ...flag.FlagOpt) CommandOpt
Flag builds a flag and adds it to a Command. It panics if a flag with the same name exists
func Footer ¶
func Footer(footer string) CommandOpt
Footer adds an Help string to the command - useful from a help function
func HelpLong ¶
func HelpLong(helpLong string) CommandOpt
HelpLong adds an Help string to the command - useful from a help function