flaggy
flaggy copied to clipboard
Consider allowing users to pass in structs of options
It could be convenient to pass in a pointer to a struct for options. Flaggy could loop over the struct fields, and depending on the property type and name, assign variables into it.
Or using tags:
type Options struct {
Name string `flaggy:"n,name,rest is description"` // short=n, long=name
Address string `flaggy:",address"` // no short, long=address, without description
Subscribed bool `flaggy:"s"` // short=s, no long, without description
Quiet bool `flaggy:"q,,quiet mode"` // short=q, no long
}
I am leaning toward calling this "out of scope" for flaggy because its so radically different than the currently patterns. I think go-flags already does a pretty good job of this.
The user experience will likely suffer if there are too many ways to do things.
I'm leaving this open for now for more discussion.
(fig)[https://github.com/kkyr/fig] seems to do a better job at this by supporting subcommands
however it makes sense for flaggy
to have this.