Skip to content

Commit

Permalink
Add example to FlagSet.ShorthandLookup
Browse files Browse the repository at this point in the history
  • Loading branch information
n10v committed May 5, 2017
1 parent 86425cb commit 75859d1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ func Example() {
}

func ExampleShorthandLookup() {
pflag.BoolP("verbose", "v", false, "verbose output")

name := "verbose"
flag := pflag.ShorthandLookup(name[:1])

fmt.Println(flag.Name)
}

func ExampleFlagSet_ShorthandLookup() {
fs := pflag.NewFlagSet("Example", pflag.ContinueOnError)
fs.BoolP("verbose", "v", false, "verbose output")

Expand Down

0 comments on commit 75859d1

Please sign in to comment.