Documentation ¶
Index ¶
- func Clean(p plugins.Plugin, flags []*flag.Flag) []*flag.Flag
- func CleanSet(p plugins.Plugin, set *flag.FlagSet) []*flag.Flag
- func Print(w io.Writer, main plugins.Plugin) error
- func SetToSlice(set *flag.FlagSet) []*flag.Flag
- type Aliaser
- type AliaserFn
- type Commander
- type CommanderFn
- type Describer
- type DescriberFn
- type FlagPrinter
- type FlagPrinterFn
- type Flagger
- type FlaggerFn
- type NamedCommander
- type Namer
- type NamerFn
- type SubCommander
- type SubCommanderFn
- type UsagePrinter
- type UsagePrinterFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clean ¶
CleanFlags sanitizes, and namespaces, flags to be used when incorporating flags from other plugins.
func CleanSet ¶
CleanFlagSet sanitizes, and namespaces, flags to be used when incorporating flags from other plugins.
func Print ¶
Print will try and print a helpful Usage printing of the plugin and any plugins that are provided.
$ foobar --------- Usage of foobar: -h, --help print this help Available Commands: foobar info Print diagnostic information (useful for debugging) foobar version Print the version information
Types ¶
type AliaserFn ¶
type AliaserFn func() []string
AliaserFn is a function that can be used to implement the Aliaser interface
func (AliaserFn) CmdAliases ¶
func (AliaserFn) PluginName ¶
type Commander ¶
type Commander interface { plugins.Plugin Main(ctx context.Context, root string, args []string) error }
Commander is a plugin that is meant to be the beginning of a CLI application
type CommanderFn ¶
CommanderFn is a function that can be used to implement the Commander interface
func (CommanderFn) PluginName ¶
func (fn CommanderFn) PluginName() string
type Describer ¶
Describer is called by `Print` and can be implemented to print a short, single line, description of the plugin. `-h`
type DescriberFn ¶
type DescriberFn func() string
DescriberFn is a function that can be used to implement the Describer interface
func (DescriberFn) Description ¶
func (fn DescriberFn) Description() string
func (DescriberFn) PluginName ¶
func (fn DescriberFn) PluginName() string
type FlagPrinterFn ¶
FlagPrinterFn is a function that can be used to implement the FlagPrinter interface
func (FlagPrinterFn) PluginName ¶
func (fn FlagPrinterFn) PluginName() string
func (FlagPrinterFn) PrintFlags ¶
func (fn FlagPrinterFn) PrintFlags(w io.Writer) error
type FlaggerFn ¶
FlaggerFn is a function that can be used to implement the Flagger interface
func (FlaggerFn) PluginName ¶
type NamedCommander ¶
type Namer ¶
Namer is a command that provides a different name for the command than the name of the Plugin
type NamerFn ¶
type NamerFn func() string
NamerFn is a function that can be used to implement the Namer interface
func (NamerFn) PluginName ¶
type SubCommander ¶
SubCommander can be implemented to provide a list of plugins.Plugin that can be used as sub-commands of the current Plugin
type SubCommanderFn ¶
type SubCommanderFn func() []Commander
SubCommanderFn is a function that can be used to implement the SubCommander interface
func (SubCommanderFn) PluginName ¶
func (fn SubCommanderFn) PluginName() string
func (SubCommanderFn) SubCommands ¶
func (fn SubCommanderFn) SubCommands() []Commander
type UsagePrinter ¶
UsagePrinter is called by `Print` and can be implemented to print a large block of usage information after the `Describer` interface is called. This is useful for printing flag information, links, and other messages to users.
type UsagePrinterFn ¶
UsagePrinterFn is a function that can be used to implement the UsagePrinter interface
func (UsagePrinterFn) PluginName ¶
func (fn UsagePrinterFn) PluginName() string
func (UsagePrinterFn) PrintUsage ¶
func (fn UsagePrinterFn) PrintUsage(w io.Writer) error