Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { EmptyCommand Arguments []string Options []CommandOption Method func(args []string, options map[string]string) error }
type CommandFork ¶
type CommandFork struct { EmptyCommand Commands []InternalCommand }
func (*CommandFork) Call ¶
func (c *CommandFork) Call(args ...string) error
type CommandOption ¶
type EmptyCommand ¶
type EmptyCommand struct {
// contains filtered or unexported fields
}
func (*EmptyCommand) Call ¶
func (c *EmptyCommand) Call(_ ...string) error
func (*EmptyCommand) Description ¶
func (c *EmptyCommand) Description() string
func (*EmptyCommand) Name ¶
func (c *EmptyCommand) Name() string
type ErrCommandNotFound ¶
type ErrCommandNotFound struct {
Name string
}
func NewErrCommandNotFound ¶
func NewErrCommandNotFound(name string) *ErrCommandNotFound
func (*ErrCommandNotFound) Error ¶
func (e *ErrCommandNotFound) Error() string
type ErrInvalidArguments ¶
type ErrInvalidArguments struct {
Expected string
}
func NewInvalidArgumentsError ¶
func NewInvalidArgumentsError(expected string) *ErrInvalidArguments
func (*ErrInvalidArguments) Error ¶
func (e *ErrInvalidArguments) Error() string
type InternalCommand ¶
Example ¶
b := NewCommand( "b", "b", nil, nil, func(args []string, options map[string]string) error { return nil }, ) a := NewCommandFork("a", "a", b) root := NewCommandFork("root", "root", a) fmt.Println(root.Call("a", "b")) fmt.Println(root.Call("a")) fmt.Println(root.Call("b"))
Output: <nil> command "" not found command "b" not found
func NewCommand ¶
func NewCommand( name, description string, arguments []string, options []CommandOption, method func(args []string, options map[string]string) error, ) InternalCommand
func NewCommandFork ¶
func NewCommandFork( name, description string, subCommands ...InternalCommand, ) InternalCommand
Click to show internal directories.
Click to hide internal directories.