Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdVersion = &Command{ UsageLine: "version", Short: "displays the program version", Run: func(_ *Command, _ io.Writer, _ []string) error { fmt.Println(Name, "version", Version) return nil }, }
View Source
var Commands []*Command
Commands lists the available commands and help topics. The order here is the order in which they are printed by 'go help'.
View Source
var ErrFormatPrefix string
View Source
var FormatErr = PrintErrExit
View Source
var Name string
View Source
var Title string
View Source
var Version = "<not set>"
Functions ¶
func FilepathRelIfShorter ¶
func FlagDefaults ¶
func PrintErrExit ¶
func PrintErrExit(err error)
Types ¶
type Command ¶
type Command struct { // Run runs the command. // The args are the arguments after the command name. Run func(cmd *Command, w io.Writer, 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 Hidden bool ExtraArgsReq int ExtraArgsMax int }
A Command is an implementation of a go command like go build or go fix.
Click to show internal directories.
Click to hide internal directories.