Documentation
¶
Overview ¶
Package cli provides a command-line interface (CLI) framework for building command-line applications.
if err := app.Execute(); err != nil { fmt.Println("Error:", err) } }
For more information and examples, please refer to the package documentation at:
https://github.com/nandlabs/golly/cli
Package cli provides functionality for handling command-line flags.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLI ¶ added in v1.2.2
type CLI struct {
// contains filtered or unexported fields
}
CLI represents the command-line interface.
func (*CLI) AddCommand ¶ added in v1.2.2
AddCommand adds a root command to the CLI.
func (*CLI) AddVersion ¶ added in v1.2.8
type Command ¶
type Command struct { Name string Usage string Version string Aliases []string Action func(ctx *Context) error SubCommands map[string]*Command Flags []*Flag }
Command represents a command in the CLI.
func NewCommand ¶ added in v1.2.2
NewCommand creates a new command with the given name, description, and handler function.
func (*Command) AddSubCommand ¶ added in v1.2.2
AddSubCommand adds a subcommand to the command.
type Context ¶
type Context struct { CommandStack []string // CommandStack stores the stack of executed commands. Flags map[string]string // Flags stores the command-line flags and their values. }
Context represents the context for the command-line interface.
func NewCLIContext ¶ added in v1.2.2
func NewCLIContext() *Context
NewCLIContext creates a new CLI context.
Click to show internal directories.
Click to hide internal directories.