Closed
Description
Hello folks, I have noticed a strange behavior about MarkFlagsRequiredTogether function. I am using cobra v1.6.1 with Golang 1.19.1. Here is the code snippet:
rootCmd.MarkFlagsRequiredTogether("accessKey", "secretKey", "bucketName", "substring", "region")
If i dont provide any of the flags, i expect cobra to throw an error but somehow it is not throwing an error. It passes that line and fails on normal application flow as expected.
BUT; if i provide at least one required flag, it gives me my desired error like that(assume that i have provided secretKey
flag:
Error: if any flags in the group [accessKey secretKey bucketName substring region] are set they must all be set; missing [accessKey bucketName region substring]
Btw i am willing to contribute that project by finding the problematic part of the code and throwing desired error. Cheers!
Metadata
Assignees
Labels
No labels
Activity