Documentation
¶
Index ¶
- type Args
- type Command
- type CommandContext
- func (ctx *CommandContext) Cmd() *Command
- func (ctx *CommandContext) Flags() *flag.FlagSet
- func (ctx *CommandContext) Fork() *CommandContext
- func (ctx *CommandContext) FullName() string
- func (ctx *CommandContext) Help() (err error)
- func (ctx *CommandContext) Name() string
- func (ctx *CommandContext) Parent() *CommandContext
- func (ctx *CommandContext) Path() []string
- func (ctx *CommandContext) Run() error
- func (ctx *CommandContext) Value(name any) any
- func (ctx *CommandContext) WithValue(name, value any) *CommandContext
- type ContextExecuteError
- type ContextParserError
- type Helper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Name string
Usage string
Description string
New func(ctx *CommandContext) (err error)
Help func(ctx *CommandContext) (err error)
Run func(ctx *CommandContext) (err error)
ParseArgs func(ctx *CommandContext) (err error)
// contains filtered or unexported fields
}
func (*Command) Parse ¶
func (b *Command) Parse(ctx *CommandContext) (_ *CommandContext, err error)
type CommandContext ¶
type CommandContext struct {
Out,
Err io.Writer
Context context.Context
InputArgs []string
Args Args
NamedArgs any
// contains filtered or unexported fields
}
func (*CommandContext) Cmd ¶
func (ctx *CommandContext) Cmd() *Command
func (*CommandContext) Flags ¶
func (ctx *CommandContext) Flags() *flag.FlagSet
func (*CommandContext) Fork ¶
func (ctx *CommandContext) Fork() *CommandContext
func (*CommandContext) FullName ¶
func (ctx *CommandContext) FullName() string
func (*CommandContext) Help ¶
func (ctx *CommandContext) Help() (err error)
func (*CommandContext) Name ¶
func (ctx *CommandContext) Name() string
func (*CommandContext) Parent ¶
func (ctx *CommandContext) Parent() *CommandContext
func (*CommandContext) Path ¶
func (ctx *CommandContext) Path() []string
func (*CommandContext) Run ¶
func (ctx *CommandContext) Run() error
func (*CommandContext) Value ¶
func (ctx *CommandContext) Value(name any) any
func (*CommandContext) WithValue ¶
func (ctx *CommandContext) WithValue(name, value any) *CommandContext
type ContextExecuteError ¶
type ContextExecuteError struct {
// contains filtered or unexported fields
}
func NewContextExecuteError ¶
func NewContextExecuteError(ctx *CommandContext, err error) *ContextExecuteError
func ToContextExecuteError ¶
func ToContextExecuteError(ctx *CommandContext, err error) (e *ContextExecuteError)
func (*ContextExecuteError) Ctx ¶
func (c *ContextExecuteError) Ctx() *CommandContext
func (*ContextExecuteError) Error ¶
func (c *ContextExecuteError) Error() string
func (*ContextExecuteError) Unwrap ¶
func (c *ContextExecuteError) Unwrap() error
type ContextParserError ¶
type ContextParserError struct {
// contains filtered or unexported fields
}
func NewContextParserError ¶
func NewContextParserError(ctx *CommandContext, event string, err error) *ContextParserError
func ToContextParserError ¶
func ToContextParserError(ctx *CommandContext, event string, err error) (e *ContextParserError)
func (*ContextParserError) Ctx ¶
func (c *ContextParserError) Ctx() *CommandContext
func (*ContextParserError) Error ¶
func (c *ContextParserError) Error() string
func (*ContextParserError) Unwrap ¶
func (c *ContextParserError) Unwrap() error
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
func Help ¶
func Help(ctx *CommandContext) *Helper
func (*Helper) SubCommands ¶
func (*Helper) WithSubCommands ¶
Click to show internal directories.
Click to hide internal directories.