Documentation
¶
Index ¶
- type CmdExecutor
- type Command
- type CommandDefinition
- type CommandDefinitions
- type CommandOptions
- type Context
- type Engine
- type Executor
- type ExitCode
- type ExitCoder
- type Flag
- type Flags
- type HandlerFunc
- type InfoWriter
- type Reader
- type Renderer
- type TableWriter
- type Validator
- type Writer
- func (w *Writer) Error(err error) error
- func (w *Writer) Errorf(format string, args ...interface{}) error
- func (w *Writer) IsTerminal() bool
- func (w *Writer) Sprintf(format string, args ...interface{}) string
- func (w *Writer) Write(data []byte) (int, error)
- func (w *Writer) Writef(format string, args ...interface{}) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdExecutor ¶
type CmdExecutor struct { }
type Command ¶
type Command struct { Command []string Description string Flags []Flag Invisible bool Handler HandlerFunc Usage string Validate Validator // contains filtered or unexported fields }
func (*Command) ExecuteContext ¶
func (*Command) FullCommand ¶
type CommandDefinition ¶
type CommandDefinition struct { Command string Description string Handler HandlerFunc Options CommandOptions }
type CommandDefinitions ¶
type CommandDefinitions []CommandDefinition
func (CommandDefinitions) Apply ¶
func (cs CommandDefinitions) Apply(e *Engine)
func (*CommandDefinitions) Register ¶
func (cs *CommandDefinitions) Register(command, description string, fn HandlerFunc, opts CommandOptions)
type CommandOptions ¶
type Context ¶
type Context interface { context.Context io.ReadWriter Arg(i int) string Args() []string Execute(cmd string, args ...string) ([]byte, error) Flags() Flags InfoWriter() InfoWriter ReadSecret() (string, error) Run(cmd string, args ...string) error Terminal(cmd string, args ...string) error Version() string Writef(format string, args ...any) error }
type Engine ¶
type Engine struct { Commands []Command Executor Executor Name string Reader *Reader Settings string Version string Writer *Writer }
func (*Engine) Command ¶
func (e *Engine) Command(command, description string, fn HandlerFunc, opts CommandOptions)
type Flag ¶
type Flag struct { Default any Description string Name string Short string Value any // contains filtered or unexported fields }
func DurationFlag ¶
func OptionFlags ¶
func StringFlag ¶
func (*Flag) UsageShort ¶
type HandlerFunc ¶
type InfoWriter ¶
type Reader ¶
var (
DefaultReader *Reader
)
func (*Reader) IsTerminal ¶
func (*Reader) TerminalRaw ¶
type TableWriter ¶
type Validator ¶
func ArgsBetween ¶
Click to show internal directories.
Click to hide internal directories.