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

Function ExampleFlagSet_ShorthandLookup

example_test.go:25–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25func ExampleFlagSet_ShorthandLookup() {
26 name := "verbose"
27 short := name[:1]
28
29 fs := pflag.NewFlagSet("Example", pflag.ContinueOnError)
30 fs.BoolP(name, short, false, "verbose output")
31
32 // len(short) must be == 1
33 flag := fs.ShorthandLookup(short)
34
35 fmt.Println(flag.Name)
36}

Callers

nothing calls this directly

Calls 3

BoolPMethod · 0.95
ShorthandLookupMethod · 0.95
NewFlagSetFunction · 0.92

Tested by

no test coverage detected