Documentation ¶
Index ¶
- Variables
- func Colorfy(msg string, fontcolor string, background string, effect string) string
- func ExtractProgramName(path string) string
- func PasswordFromReader(reader io.Reader) (string, error)
- func RegisterExtraCmd(cmd Command)
- type Cancelable
- type Command
- type ConfirmationCommand
- type Context
- type DeprecatedCommand
- type FlaggedCommand
- type Info
- type Lookup
- type Manager
- func (m *Manager) Register(command Command)
- func (m *Manager) RegisterDeprecated(command Command, oldName string)
- func (m *Manager) RegisterRemoved(name string, help string)
- func (m *Manager) RegisterTopic(name, content string)
- func (m *Manager) Run(args []string)
- func (m *Manager) SetExiter(e exiter)
- type MapFlag
- type MapFlagWrapper
- type PanicExitError
- type PanicExiter
- type RemovedCommand
- type StringSliceFlag
- type StringSliceFlagWrapper
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAbortCommand = errors.New("") // ErrLookup is the error that should be returned by lookup functions when it // cannot find a matching command for the given parameters. ErrLookup = errors.New("lookup error - command not found") )
Functions ¶
func ExtractProgramName ¶
func RegisterExtraCmd ¶
func RegisterExtraCmd(cmd Command)
Types ¶
type Cancelable ¶
type Cancelable interface { // Cancel handles the command cancellation and is required to be thread safe as // this method is called by a different goroutine. // Cancel should return an error if the operation is not cancelable yet/anymore or there // was any error during the cancellation. // Cancel may be called multiple times. Cancel(context Context) error }
Cancelable are implemented by commands that support cancellation
type ConfirmationCommand ¶
type ConfirmationCommand struct {
// contains filtered or unexported fields
}
func (*ConfirmationCommand) Confirm ¶
func (cmd *ConfirmationCommand) Confirm(context *Context, question string) bool
func (*ConfirmationCommand) Flags ¶
func (cmd *ConfirmationCommand) Flags() *gnuflag.FlagSet
type DeprecatedCommand ¶
type DeprecatedCommand struct { Command // contains filtered or unexported fields }
func (*DeprecatedCommand) Flags ¶
func (c *DeprecatedCommand) Flags() *gnuflag.FlagSet
func (*DeprecatedCommand) Run ¶
func (c *DeprecatedCommand) Run(context *Context) error
type FlaggedCommand ¶
type Manager ¶
type Manager struct { Commands map[string]Command AfterFlagParseHook func() RetryHook func(err error) (retry bool) // contains filtered or unexported fields }
func NewManager ¶
This is discouraged: use NewManagerPanicExiter instead. Handle panic(*PanicExitError) accordingly
func NewManagerPanicExiter ¶
func NewManagerPanicExiter(name string, stdout, stderr io.Writer, stdin io.Reader, lookup Lookup) *Manager
When using this, you should handle panic(*PanicExitError) accordingly
func (*Manager) RegisterDeprecated ¶
func (*Manager) RegisterRemoved ¶
func (*Manager) RegisterTopic ¶
type MapFlagWrapper ¶
func (MapFlagWrapper) Set ¶
func (f MapFlagWrapper) Set(val string) error
func (MapFlagWrapper) String ¶
func (f MapFlagWrapper) String() string
type PanicExitError ¶
type PanicExitError struct {
Code int
}
func (*PanicExitError) Error ¶
func (e *PanicExitError) Error() string
type PanicExiter ¶
type PanicExiter struct{}
func (PanicExiter) Exit ¶
func (e PanicExiter) Exit(code int)
type RemovedCommand ¶
func (*RemovedCommand) Info ¶
func (c *RemovedCommand) Info() *Info
func (*RemovedCommand) Run ¶
func (c *RemovedCommand) Run(context *Context) error
type StringSliceFlag ¶
type StringSliceFlag []string
func (*StringSliceFlag) Set ¶
func (f *StringSliceFlag) Set(val string) error
func (*StringSliceFlag) String ¶
func (f *StringSliceFlag) String() string
type StringSliceFlagWrapper ¶
type StringSliceFlagWrapper struct {
Dst *[]string
}
func (StringSliceFlagWrapper) Set ¶
func (f StringSliceFlagWrapper) Set(val string) error
func (StringSliceFlagWrapper) String ¶
func (f StringSliceFlagWrapper) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.