Let's say I have this flag in my program that only prints a positive number:
c.PersistentFlags().IntVar(&SomeFlag, optionSomeFlag, 0, "do something (range: x-y)")
The default is 0 so if the user doesn't toggle the flag, nothing is printed. How can I make the flag accept arguments but have a default itself? i.e. if the default was 5
./program --someflag
output would be 5
but if I did
./program --someflag=1
output would be 1
I tried following the user guide for Cobra and was expecting a command type that would allow me to specify default values only if the user triggers the flag, not just altogether. I may have misinterpreted this or missed something though.