commands

package
v0.0.0-...-13800ec Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AvaillableCommand = []*Command{}
)

Functions

This section is empty.

Types

type Command

type Command struct {
	//Run runs the commande.
	//the args are the argument after the command name.
	Run func(cmd *Command, args []string) int

	//PreRun perform an operation before running the commande.
	PreRun func(cmd *Command, args []string)

	//UsageLine is the online usage message
	UsageLine string

	//Short is the short description shown in the go help output.
	Short string

	//Long is the long description shown in 'go help <this-command>' output.
	Long string

	//Flag is set of flag specifique to this command
	Flag flag.FlagSet

	// CustomFlags indicates that the command will do its own
	// flag parsing.
	CustomFlags bool
	// contains filtered or unexported fields
}

Unit execution

func (*Command) Name

func (c *Command) Name() string

Name return the command's name: the first word in the usage line.

func (*Command) Out

func (c *Command) Out() io.Writer

Out return the out writer of the current Command if cmd.output is nil, os.Stderr is used

func (*Command) SetOutput

func (c *Command) SetOutput(output io.Writer)

Sets output set the destination for usage and error messages. if output is nil os.stderr is used

func (*Command) Usage

func (c *Command) Usage()

Usage put out the usage for the Command

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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