MCPcopy
hub / github.com/spf13/pflag / Error

Method Error

errors.go:28–48  ·  errors.go::NotExistError.Error

Error implements error.

()

Source from the content-addressed store, hash-verified

26
27// Error implements error.
28func (e *NotExistError) Error() string {
29 switch e.messageType {
30 case flagNotExistMessage:
31 return fmt.Sprintf("flag %q does not exist", e.name)
32
33 case flagNotDefinedMessage:
34 return fmt.Sprintf("flag accessed but not defined: %s", e.name)
35
36 case flagNoSuchFlagMessage:
37 return fmt.Sprintf("no such flag -%v", e.name)
38
39 case flagUnknownFlagMessage:
40 return fmt.Sprintf("unknown flag: --%s", e.name)
41
42 case flagUnknownShorthandFlagMessage:
43 c := rune(e.name[0])
44 return fmt.Sprintf("unknown shorthand flag: %q in -%s", c, e.specifiedShorthands)
45 }
46
47 panic(fmt.Errorf("unknown flagNotExistErrorMessageType: %v", e.messageType))
48}
49
50// GetSpecifiedName returns the name of the flag (without dashes) as it
51// appeared in the parsed arguments.

Callers 15

TestValueRequiredErrorFunction · 0.45
TestInvalidValueErrorFunction · 0.45
TestBoolFuncCompatFunction · 0.45
TestEverythingFunction · 0.45
TestNoArgumentFunction · 0.45
TestUsageFunction · 0.45
TestAnnotationFunction · 0.45
testParseFunction · 0.45
testParseAllFunction · 0.45
TestShorthandFunction · 0.45
TestShorthandLookupFunction · 0.45

Calls

no outgoing calls

Tested by 15

TestValueRequiredErrorFunction · 0.36
TestInvalidValueErrorFunction · 0.36
TestBoolFuncCompatFunction · 0.36
TestEverythingFunction · 0.36
TestNoArgumentFunction · 0.36
TestUsageFunction · 0.36
TestAnnotationFunction · 0.36
testParseFunction · 0.36
testParseAllFunction · 0.36
TestShorthandFunction · 0.36
TestShorthandLookupFunction · 0.36