I've got a basic config file that's mashalled and unmarshalled by viper to a struct.
type Config struct {
field1 string
field2 string
field3 string
}
I want to set up cobra to let me do myapp get field1
and myapp set field1 foo
for each field in my config. Ideally without hand-coding a command for each, since they all just call viper.Set
and write the file.. Is it possible to get Cobra to just auto-generate the sub-commands based on the struct somehow?