docopt / docopt.go

A command-line arguments parser that will make you smile.
http://docopt.org/
MIT License
1.43k stars 111 forks source link

Show example of repeatable flag #43

Open mcandre opened 7 years ago

mcandre commented 7 years ago

Does docopt support repeating flags, like hello -e name:bob -e hair:nil? If so, could the README please add an example of the docopt string syntax for enabling this for one or more named flags?

eirannejad commented 5 years ago

Any data type other than the built-in getters e.g. opts.Bool() can be accessed like a normal map object.

// needs type assertion to convert the type correctly
repeatedValues,_ := opts["--map"].([]string)