cobra icon indicating copy to clipboard operation
cobra copied to clipboard

Consistent annotation names

Open nirs opened this issue 9 months ago • 0 comments

Add Annotation suffix to the private annotations to allow nicer code using the constants.

For example one can use the current annotation names as a temporary variable instead of unclear shortcut. Instead of this:

rag := flagsFromAnnotation(c, f, requiredAsGroup)
me := flagsFromAnnotation(c, f, mutuallyExclusive)
or := flagsFromAnnotation(c, f, oneRequired)

We can use now:

requiredAsGrop := flagsFromAnnotation(c, f, requiredAsGroupAnnotation)
mutuallyExclusive := flagsFromAnnotation(c, f, mutuallyExclusiveAnnotation)
oneRequired := flagsFromAnnotation(c, f, oneRequiredAnnotation)

Example taken from #2105.

nirs avatar May 03 '24 17:05 nirs