Skip to content

Ellipsis not working for anything but strings #68

Open
@codesoap

Description

Suppose I have this program:

package main

import (
	`fmt`
	`github.com/docopt/docopt-go`
)

func main() {
	opts, _ := docopt.ParseDoc(`
		Usage:
		    mytool --number=<num>...`)

	var conf struct {
		Number []int
	}
	if err := opts.Bind(&conf); err != nil {
		panic(err)
	}

	fmt.Printf("%v\n", conf)
}

When executing go run mytool.go I get this error:

panic: value of "--number" is not assignable to "Number" field

goroutine 1 [running]:
main.main()
        /<path_to_script>/mytool.go:17 +0x190
exit status 2

If I change []int to []string everything works.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions