admincli

package
v4.10.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2018 License: GPL-3.0 Imports: 2 Imported by: 4

Documentation

Index

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) Run

func (g *GenericCLIModule) Run(ctx context.Context, output io.Writer, args ...string) (argsOk bool)

func (*GenericCLIModule) Runnable

func (g *GenericCLIModule) Runnable() bool

func (*GenericCLIModule) Usage

func (g *GenericCLIModule) Usage() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL