Documentation
¶
Overview ¶
Package cli defines a lightweight framework for building CLI commands. It's designed to be generic and self-contained, with no embedded business logic or dependencies on the surrounding application's configuration or behavior.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Version ¶
func Version() string
Version return the version information for the binary, which is constructed following https://go.dev/ref/mod#versions.
Types ¶
type Command ¶
type Command struct {
// Short is a concise one-line description of the command.
Short string
// UsageLine is the one line usage.
UsageLine string
// Long is the full description of the command.
Long string
// Action executes the command.
Action func(context.Context, *Command) error
// Commands are the sub commands.
Commands []*Command
// Flags is the command's flag set for parsing arguments and generating
// usage messages. This is populated for each command in init().
Flags *flag.FlagSet
// Config contains the configs for the command.
Config *config.Config
}
Command represents a single command that can be executed by the application.
func (*Command) Init ¶
Init creates a new set of flags for the command and initializes them such that any parsing failures result in the command usage being displayed.
Click to show internal directories.
Click to hide internal directories.