Documentation
¶
Index ¶
- type ColumnWriter
- type Command
- type CommandDefinition
- type CommandDefinitions
- type CommandOptions
- type Context
- type Engine
- type Executor
- type ExitCoder
- type Flag
- type FlagType
- 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 ...any) error
- func (w *Writer) IsTerminal() bool
- func (w *Writer) Sprintf(format string, args ...any) string
- func (w *Writer) Write(data []byte) (int, error)
- func (w *Writer) Writef(format string, args ...any) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnWriter ¶ added in v1.8.0
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 ¶ added in v1.1.0
type CommandDefinition struct {
Command string
Description string
Handler HandlerFunc
Options CommandOptions
}
type CommandDefinitions ¶ added in v1.1.0
type CommandDefinitions []CommandDefinition
func (CommandDefinitions) Apply ¶ added in v1.1.0
func (cs CommandDefinitions) Apply(e *Engine)
func (*CommandDefinitions) Register ¶ added in v1.1.0
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
Cleanup(func())
Execute(cmd string, args ...string) ([]byte, error)
Flags() Flags
Info() InfoWriter
IsTerminal() bool
IsTerminalReader() bool
IsTerminalWriter() bool
ReadSecret() (string, error)
Run(cmd string, args ...string) error
Table(columns ...any) TableWriter
Columns() ColumnWriter
Terminal(cmd string, args ...string) error
Version() string
Writef(format string, args ...any)
}
type Engine ¶
type Engine struct {
Commands []Command
Executor Executor
Flags []Flag
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 ¶
type HandlerFunc ¶
type InfoWriter ¶ added in v1.1.0
type Reader ¶
var (
DefaultReader *Reader
)
func (*Reader) IsTerminal ¶
func (*Reader) TerminalRaw ¶
type TableWriter ¶ added in v1.1.0
type Validator ¶
func ArgsBetween ¶
Click to show internal directories.
Click to hide internal directories.