I'm defining some flags like this:
follow_sync_gwCmd.PersistentFlags().String("url", "", "Sync Gateway URL")
follow_sync_gwCmd.MarkPersistentFlagRequired("url")
and even explicitly calling ParseFlags (out of desperation):
Run: func(cmd *cobra.Command, args []string) {
if err := cmd.ParseFlags(args); err != nil {
log.Printf("err: %v", err)
}
...
},
and calling:
$ go run main.go follow_sync_gw
with no --url flag, but cobra isn't throwing errors.
I was expecting that if I set MarkPersistentFlagRequired but failed to pass the flag on the command line then the command would fail with an error and a usage example.
I'm defining some flags like this:
and even explicitly calling
ParseFlags(out of desperation):and calling:
with no
--urlflag, but cobra isn't throwing errors.I was expecting that if I set
MarkPersistentFlagRequiredbut failed to pass the flag on the command line then the command would fail with an error and a usage example.