spf13/cobra

Embedded flags causes "unknown flag"

chasefleming opened this issue · 0 comments

If you use embedding to extend some flags for certain use cases you get the error unknown flag. For example, take a look at this code:

type mainFlagsCollection struct {
	skip       bool `default:"false" flag:"skip" info:"Skip example"`
}

type extraFlagsCollection struct {
	mainFlagsCollection
	name string `default:"" flag:"name" info:"Provide an example name"`
}

In that, name will work, but skip will trigger the error.