Cli: Short flag name don't trigger required setting

Created on 29 Aug 2019  路  3Comments  路  Source: urfave/cli

app.Flags = []cli.Flag{
    cli.StringSliceFlag{
      Name: "names, N",
      Required: true,
    },
  }

For example, flag setted as described, and i can write in terminal something like cli --names qwe --names asd - and that's fine. But also i should be able to write cli -N qwe -N asd and that's should work too, but i've got error.

Required flag "names" not set

kinbug statuclaimed statuconfirmed

All 3 comments

A small repro would be nice, so we don't have to spend time crafting it up ourselves.

https://gist.github.com/errashe/2523b86554350a5e721ad015aecae796

Here we can run go run t.go --names qwe --names asd and that's will be fine. But if we try to use short tag - go run t.go -N qwe -N asd - got error (Required flag "names" not set).

Thanks @errashe! That repro makes sense, I'm marking this as help wanted since it's a pretty obvious bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

costela picture costela  路  3Comments

nkprince007 picture nkprince007  路  5Comments

l0k18 picture l0k18  路  3Comments

millken picture millken  路  5Comments

blackrez picture blackrez  路  5Comments