Skip to content

Commit

Permalink
Merge pull request #292 from farbodsalimi/fix-readme-typos
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
jessevdk committed Dec 21, 2018
2 parents 5de817a + 594cb3b commit 57c9cb6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -62,7 +62,7 @@ var opts struct {
Name string `short:"n" long:"name" description:"A name" required:"true"`

// Example of a flag restricted to a pre-defined set of strings
Name string `long:"animal" choice:"cat" choice:"dog"`
Animal string `long:"animal" choice:"cat" choice:"dog"`

// Example of a value name
File string `short:"f" long:"file" description:"A file" value-name:"FILE"`
Expand Down Expand Up @@ -94,6 +94,7 @@ args := []string{
"-vv",
"--offset=5",
"-n", "Me",
"--animal", "dog", // anything other than "cat" or "dog" will raise an error
"-p", "3",
"-s", "hello",
"-s", "world",
Expand All @@ -118,6 +119,7 @@ if err != nil {
fmt.Printf("Verbosity: %v\n", opts.Verbose)
fmt.Printf("Offset: %d\n", opts.Offset)
fmt.Printf("Name: %s\n", opts.Name)
fmt.Printf("Animal: %s\n", opts.Animal)
fmt.Printf("Ptr: %d\n", *opts.Ptr)
fmt.Printf("StringSlice: %v\n", opts.StringSlice)
fmt.Printf("PtrSlice: [%v %v]\n", *opts.PtrSlice[0], *opts.PtrSlice[1])
Expand Down

0 comments on commit 57c9cb6

Please sign in to comment.