Documentation
¶
Overview ¶
Package cli provides helpers for common NCA command-line tools' needs
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseOptions ¶
type BaseOptions struct {
ConfigFile string `short:"c" long:"config" description:"path to NCA config file" required:"true"`
}
BaseOptions represents the simplest possible list of CLI options an NCA command can have: a config file. Commands should extend this rather than having their own custom type in order to ensure consistency.
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI centralizes the CLI parser as well as functionality around it
func New ¶
func New(opts interface{}) *CLI
New returns a CLI instance for parsing flags into the given structure
func Simple ¶
func Simple() *CLI
Simple returns a CLI instance for parsing just a --config flag, simplifying the tools which don't need special-case handling
func (*CLI) AppendUsage ¶
AppendUsage adds a string which will be printed when usage is displayed
func (*CLI) GetConf ¶
GetConf parses the command-line flags and returns the config file - it is assumed that the options structure includes a ConfigFile string (which is free if BaseOptions is an embedded type)