Documentation ¶
Index ¶
- Variables
- func HandleHelp(appName string, req *cmds.Request, out io.Writer) error
- func LongHelp(rootName string, root *cmds.Command, path []string, out io.Writer) error
- func Parse(ctx context.Context, input []string, stdin *os.File, root *cmds.Command) (*cmds.Request, error)
- func Run(ctx context.Context, root *cmds.Command, cmdline []string, ...) error
- func ShortHelp(rootName string, root *cmds.Command, path []string, out io.Writer) error
- type Closer
- type ExitError
- type ResponseEmitter
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoHelpRequested = errors.New("no help requested")
ErrNoHelpRequested returns when request for help help does not include the short nor the long option.
Functions ¶
func HandleHelp ¶
HandleHelp writes help to a writer for the given request's command.
func Parse ¶
func Parse(ctx context.Context, input []string, stdin *os.File, root *cmds.Command) (*cmds.Request, error)
Parse parses the input commandline string (cmd, flags, and args). returns the corresponding command Request object.
This function never returns nil, even on error.
Types ¶
type Closer ¶
type Closer interface {
Close()
}
Closer is a helper interface to check if the env supports closing
type ExitError ¶
type ExitError int
ExitError is the error used when a specific exit code needs to be returned.
type ResponseEmitter ¶
type ResponseEmitter interface { cmds.ResponseEmitter Stdout() io.Writer Stderr() io.Writer // SetStatus sets the exit status for this command. SetStatus(int) // Status returns the exit status for the command. Status() int }
ResponseEmitter extends cmds.ResponseEmitter to give better control over the command line
func NewResponseEmitter ¶
NewResponseEmitter constructs a new response emitter that writes results to the console.
Click to show internal directories.
Click to hide internal directories.