Add flag category support (#796)#1368
Conversation
This adds what I think needs to be done to support categories for flags but we will see if that works. It also forces the scripts to use python2 since they blow up under python3 which is becoming the default python on many linux systems. Small fix to app_test as well so it conforms to the new Flag interface.
Let us use this repo via replace locally.
…s1990/cli into michaeljs1990-add-flag-category-support
with internal maps instead of slices and slightly less public API surface area
| type CategorizableFlag interface { | ||
| VisibleFlag | ||
|
|
||
| GetCategory() string |
There was a problem hiding this comment.
Rename to just Category(). golang doesnt recommend using GetXXX
There was a problem hiding this comment.
What about the conflict with the field name Category? 🤔 I agree that GetXXX is generally bad style, but this is a language-level wart we're working around.
| catNames = append(catNames, name) | ||
| } | ||
|
|
||
| sort.Strings(catNames) |
There was a problem hiding this comment.
IIUC ranging over a map has undefined sort order: https://go.dev/play/p/aR7JKg4ae8r Or did you mean something else? 🤔
| DefaultText string | ||
| Destination *bool | ||
| HasBeenSet bool | ||
| Category string |
There was a problem hiding this comment.
@meatballhat How would this tie-in with your generator code ?
There was a problem hiding this comment.
If all the flag types defined in this repo have Category fields, then it'd be part of the struct template. Or did you mean the potential merge conflict? (or something else?)
…g-category-support
…g-category-support
What type of PR is this?
What this PR does / why we need it:
See #796
Which issue(s) this PR fixes:
Closes #259
Special notes for your reviewer:
This PR is a best-effort porting of #796 so detailed criticism is very much appreciated 🙇🏼
Release Notes