command

package
v0.0.0-...-b76ad68 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2015 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdout io.Writer = os.Stdout
	Stderr io.Writer = os.Stderr
	Stdin  io.Reader = os.Stdin
)
View Source
var AppInfo string = "LiteIDE golang tool."
View Source
var AppName string = "tools"
View Source
var AppVersion string = "1.0"

Functions

func Atexit

func Atexit(f func())

func CommandList

func CommandList() (cmds []string)

func Errorf

func Errorf(format string, args ...interface{})

func Exit

func Exit()

func ExitIfErrors

func ExitIfErrors()

func Fatalf

func Fatalf(format string, args ...interface{})

func Main

func Main()

func Register

func Register(cmd *Command)

func RunArgs

func RunArgs(arguments []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

func SetExitStatus

func SetExitStatus(n int)

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

	// 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

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

A Command is an implementation of a go command like go build or go fix.

func (*Command) Name

func (c *Command) Name() string

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

func (*Command) PrintUsage

func (c *Command) PrintUsage()

func (*Command) Printf

func (c *Command) Printf(format string, args ...interface{})

func (*Command) Println

func (c *Command) Println(args ...interface{})

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 importpath.

func (*Command) Usage

func (c *Command) Usage()

Jump to

Keyboard shortcuts

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