I\'ve created a cobra command and added a flag:
cmd.Flags().StringVarP(&primaryIP, \"primary-ip\", \"p\", \"\", \"Help text\")
Is there a w
A few months ago this behavior was changed in cobra
, although the documentation is not very clear on this. Now if you mark a flag as MarkFlagRequired("primary-ip")
and you don't supply such a flag, running the command will print the help plus
required flag(s) "primary-ip"
exit status 1
at the end where the missing required flags are stated.