commands

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableCommands = []*Command{}

Functions

This section is empty.

Types

type Command

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

	// PreRun performs an operation before running the command
	PreRun func(cmd *Command, args []string)

	// UsageLine is the one-line Usage message.
	// The first word in the line is taken to be the command name.
	UsageLine string

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

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

	// Flag is a set of flags specific to this command.
	Flag flag.FlagSet

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

Command is the unit of execution

func (*Command) Name

func (c *Command) Name() string

Name returns the command's name: the first word in the Usage line.

func (*Command) Options

func (c *Command) Options() map[string]string

func (*Command) Out

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

Out returns the out writer of the current command. If cmd.output is nil, os.Stderr is used.

func (*Command) Runnable

func (c *Command) Runnable() bool

Runnable reports whether the command can be run; otherwise it is a documentation pseudo-command such as import path.

func (*Command) SetOutput

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

SetOutput sets the destination for Usage and error messages. If output is nil, os.Stderr is used.

func (*Command) Usage

func (c *Command) Usage()

Usage puts out the Usage for the command.

Directories

Path Synopsis
Package dlv ...
Package dlv ...
Package rs ...
Package rs ...

Jump to

Keyboard shortcuts

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