Open tmbdev opened 4 years ago
You are using a tab between --flag
and a
. The docopt website says:
Use two spaces to separate options with their informal description.
If you replace the tab with two (or more) spaces, it works:
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
<nil>
$ go run mytest.go --flag
true
<nil>
@tmbdev it looks like that this ticket can be closed?
Wouldn't it make sense to permit tabs?
On Thu, Nov 30, 2023, 01:49 Marco Molteni @.***> wrote:
@tmbdev https://github.com/tmbdev it looks like that this ticket can be closed?
— Reply to this email directly, view it on GitHub https://github.com/docopt/docopt.go/issues/73#issuecomment-1833426282, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRQPZ7LTTSM3RHUPZH4NTYHBJD5AVCNFSM4LSOEOF2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBTGM2DENRSHAZA . You are receiving this because you were mentioned.Message ID: @.***>
@tmbdev I am just an observer, so take my answer for what is worth. Permitting tabs would require to reach consensus on all the docopt project, not only docopt.go. The whole project itself seems to be inactive (see #74) This ticket is solved: just use spaces :-)
Boolean options don't seem to work the way they should. Here is an example: