Open
Description
Boolean options don't seem to work the way they should. Here is an example:
package main
import (
"fmt"
"github.com/docopt/docopt-go"
)
var usage string = `
Mytest.
Usage:
mytest [options]
Options:
--flag a flag
`
func main() {
opts, _ := docopt.ParseDoc(usage)
flag, err := opts.Bool("--flag")
fmt.Println(flag)
fmt.Println(err)
}
$ go run mytest.go
false
key: "--flag" failed type conversion
$ go run mytest.go --flag
--flag requires argument
Usage:
mytest [options]
exit status 1
$ go run mytest.go --flag=true
false
key: "--flag" failed type conversion
$ go version
go version go1.14.1 linux/amd64
$
Metadata
Assignees
Labels
No labels