cobra
cobra copied to clipboard
cobra.Command.Flags().Lookup() should return an error for flags that don't exist
I think that the code would be more robust if it handled the case where a flag lookup with an error
Lookup()
returns nil
when the flag does not exist. What scenario would an error improve?
That being said, the Lookup()
function is not implemented in Cobra but in spf13/pflag: https://github.com/spf13/pflag/blob/d5e0c0615acee7028e1e2740a11102313be88de1/flag.go#L355