We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On commit ee0de3b
package main import ( "fmt" "os" "github.com/docopt/docopt-go" ) func main() { usage := `Naval Fate. Usage: naval_fate.py ship [--speed=<kn>] naval_fate.py -h | --help naval_fate.py --version Options: -h --help Show this screen. --version Show version. --speed=<kn> Speed in knots [default: 10]. ` { // this works args, err := docopt.ParseDoc(usage) if err != nil { panic(err) } fmt.Printf("%+v\n", args) fmt.Println(args["--speed"]) } { // this panics parser := &docopt.Parser{ HelpHandler: docopt.PrintHelpOnly, OptionsFirst: true, } args, err := parser.ParseArgs(usage, os.Args[1:], "naval_fate.py") if err != nil { panic(err) } fmt.Printf("%+v\n", args) fmt.Println(args["--speed"]) } }
∀ go run docopt_wat.go ship --speed 23 map[ship:true --speed:23 --help:false --version:false] 23 Usage: naval_fate.py ship [--speed=<kn>] naval_fate.py -h | --help naval_fate.py --version panic: goroutine 1 [running]: main.main() /home/pete/docopt_wat.go:36 +0x2f6 exit status 2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
On commit ee0de3b
The text was updated successfully, but these errors were encountered: