package cmdflag
import "cmd/go/internal/cmdflag"
Package cmdflag handles flag processing common to several go tools.
Index ¶
- func IsBool(v flag.Value) bool
- func SetBool(cmd string, flag *bool, value string)
- func SetInt(cmd string, flag *int, value string)
- func SyntaxError(cmd, msg string)
- type Defn
Functions ¶
func IsBool ¶
IsBool reports whether v is a bool flag.
func SetBool ¶
SetBool sets the addressed boolean to the value.
func SetInt ¶
SetInt sets the addressed integer to the value.
func SyntaxError ¶
func SyntaxError(cmd, msg string)
SyntaxError reports an argument syntax error and exits the program.
Types ¶
type Defn ¶
type Defn struct { Name string // Name on command line. BoolVar *bool // If it's a boolean flag, this points to it. Value flag.Value // The flag.Value represented. PassToTest bool // Pass to the test binary? Used only by go test. Present bool // Flag has been seen. }
Defn defines a flag we know about.
func Parse ¶
Parse sees if argument i is present in the definitions and if so, returns its definition, value, and whether it consumed an extra word. If the flag begins (cmd+".") it is ignored for the purpose of this function.
Source Files ¶
- Version
- v1.9.2
- Published
- Oct 25, 2017
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 1 minute ago –
Tools for package owners.