Skip to content
New issue

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

Can not specify a flags 2+ times #29

Open
kovetskiy opened this issue Jul 7, 2015 · 0 comments
Open

Can not specify a flags 2+ times #29

kovetskiy opened this issue Jul 7, 2015 · 0 comments

Comments

@kovetskiy
Copy link

Hello, I have this docopt help-usage:

package main

import (
    "fmt"

    "github.com/docopt/docopt-go"
)

const (
    usage = `
Tool 1.0

Usage:
    tool [options] -P (-a|-r) <package>
    tool [options] -S (-a|-r) <config>

Options:
    -P --package     Package mode
        -a --add     add package
        -r --remove  remove package
    -S --service     Service mode
        -a --add     add service
        -r --remove  remove service
`
)

func main() {
    args, err := docopt.Parse(usage, nil, true, "tool 1.0", true, false)
    if err != nil {
        panic(err)
    }
    fmt.Printf("XXXXXX a.go:32: args: %#v\n", blah)
}

But when I run docopt.Parse with this usage, I got:

panic: -a is specified ambiguously 2 times

goroutine 1 [running]:
main.main()
        /home/vxw/a.go:30 +0x10a

So, this is really correct behaviour? Why usage can't have a repetable flags?

@gdey gdey mentioned this issue Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant