Documentation
¶
Index ¶
- func FormatValue(value any) string
- type Command
- type Context
- func (ctx *Context) App() any
- func (ctx *Context) Args() []string
- func (ctx *Context) Get[T any](name string, fallback ...T) T
- func (ctx *Context) JSON(data any) error
- func (ctx *Context) Print(values ...any) error
- func (ctx *Context) Println(values ...any) error
- func (ctx *Context) Table(data any) error
- type ExecuteConfig
- type FlagSet
- type Flags
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command interface {
Name() string
Summary() string
Run(ctx context.Context, cmd *Context) error
}
Command is an application command executed by the project binary.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is the execution context for application commands.
func NewContext ¶
NewContext creates a command context.
type ExecuteConfig ¶
type ExecuteConfig struct {
Name string
Usage string
DefaultArgs []string
Writer io.Writer
ErrWriter io.Writer
}
ExecuteConfig configures command execution.
type FlagSet ¶
type FlagSet struct {
// contains filtered or unexported fields
}
FlagSet is the command flag definition facade.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores application commands.
func (*Registry) Execute ¶
func (registry *Registry) Execute(ctx context.Context, app any, args []string, config ExecuteConfig) error
Execute runs a command set. Empty args use DefaultArgs.
Click to show internal directories.
Click to hide internal directories.