listendev/lstn

The first local flag inherits the wrong group from the last flagset

leodido opened this issue · 0 comments

Describe the bug

When using nested flags (eg., flags.DebugFlags) with a flagset annotation as the last field of an Options struct together with local flags, the first local flags wrongly inherits such a flagset.

type Version struct {
	Verbosity        int  `name:"verbosity" shorthand:"v" desc:"increment the verbosity level" type:"count" validate:"gte=0" json:"verbosity"`
	Changelog        bool `name:"changelog" flag:"changelog" desc:"output the relase notes URL" json:"changelog"`
	flags.DebugFlags `flagset:"Debug"`
}

Please include:

  • v0.4.0
  • darwin

Steps to reproduce the behavior

  1. Type this lstn version --help or lstn help version
  2. View the output
Print out version information

Usage:
  lstn version

Flags:
      --changelog   output the relase notes URL

Debug Flags:
  -v, -- count          increment the verbosity level
      --debug-options   output the options, then exit

Global Flags:
      --config string   config file (default is $HOME/.lstn.yaml)
  1. Notice the -v flag being under the 'Debug Flagsgroup rather than under the local flags (ie.,Flags`).

Expected vs actual behavior

The -v flag to be under the local flags of the lstn version child command.

Logs

NONE