tree: 2fe5f8f37d19b5d6d4f7d2684d46b3906f7d84f0 [path history] [tgz]
  1. command.go
  2. README.md
api/apic/commands/README.md

commands


import "android.googlesource.com/platform/tools/gpu/api/apic/commands"

Usage

func CheckErrors

func CheckErrors(apiName string, errs parse.ErrorList)

CheckErrors will, if len(errs) > 0, print each of the error messages for the specified api and then terminate the program. If errs is zero length, CheckErrors does nothing.

func Filter

func Filter(prefix string) (result []*Command)

Filter returns the filtered list of commands who's names match the specified prefix.

func Log

func Log(message string, args ...interface{})

Log prints message with the formatting args to stdout.

func MaybeError

func MaybeError(file string, err error)

MaybeError will, if err is not nil, print the error err along with the optional file path to stderr and then terminate the program. If err is nil, MaybeError does nothing.

func Register

func Register(c *Command)

Register adds a new command to the supported set, it will panic if a duplicate name is encountered.

func Usage

func Usage(message string, args ...interface{})

Usage prints message with the formatting args (if not empty) to stderr, prints the command usage information to stderr and then terminates the program.

type Command

type Command struct {
	Name      string                   // The name of the command
	Run       func(flags flag.FlagSet) // the action for the command
	ShortHelp string                   // Help for how to use the command
	Flags     flag.FlagSet             // The command line flags it accepts
}

Command holds information about a runnable api command.