DavidGamba/go-getoptions

Startup panic when alias matches the beginning of preexisting option

Closed this issue · 0 comments

Code to reproduce it:

    opt = New()
    opt.Bool("fleg", false)
    opt.Bool("flag", false, "f")
    _, err = opt.Parse([]string{})

Output:

panic: Alias 'f' is already defined for option 'fleg'

Workaround: Define the option with the alias before the one without.

    opt = New()
    opt.Bool("flag", false, "f")
    opt.Bool("fleg", false)
    _, err = opt.Parse([]string{})