Documentation
¶
Index ¶
- Constants
- type CLIModule
- type GenericCLIModule
- func (g *GenericCLIModule) Children() []CLIModule
- func (g *GenericCLIModule) Hint() string
- func (g *GenericCLIModule) Name() string
- func (g *GenericCLIModule) Run(ctx context.Context, output io.Writer, args ...string) (argsOk bool)
- func (g *GenericCLIModule) Runnable() bool
- func (g *GenericCLIModule) Usage() string
Constants ¶
View Source
const ConsoleWidth key = 0
View Source
const MaxHintLength = 50
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIModule ¶
type CLIModule interface {
//The children under this module. Invalid if runnable = true
Children() []CLIModule
//The short name of this module. e.g "adduser"
Name() string
//The help hint for this module. This will be truncated to
//MaxHintLength characters, so keep it short
Hint() string
//The full help text for the module. No length restrictions.
//Try not to introduce artificial line breaks, the text will
//be wrapped automatically (one line per paragraph is good)
Usage() string
//Is this a command? false if it is a category
Runnable() bool
//Run this module. Return when the command is done.
//Do not write to output after returning
//The context will contain the final window width as well.
//ctx.Value(adminCli.ConsoleWidth) will be an integer. -1 if unknown
//and >1 if the width is known
Run(ctx context.Context, output io.Writer, args ...string) (argsOk bool)
}
type GenericCLIModule ¶
type GenericCLIModule struct {
MChildren []CLIModule
MName string
MHint string
MUsage string
MRunnable bool
MRun func(context.Context, io.Writer, ...string) bool
}
func (*GenericCLIModule) Children ¶
func (g *GenericCLIModule) Children() []CLIModule
func (*GenericCLIModule) Hint ¶
func (g *GenericCLIModule) Hint() string
func (*GenericCLIModule) Name ¶
func (g *GenericCLIModule) Name() string
func (*GenericCLIModule) Runnable ¶
func (g *GenericCLIModule) Runnable() bool
func (*GenericCLIModule) Usage ¶
func (g *GenericCLIModule) Usage() string
Click to show internal directories.
Click to hide internal directories.