New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flag category support (#796) #1368
Changes from all commits
ff1c0b5
7c383b0
9dd96e9
51aebb5
9720ac0
50b52ca
4495869
75e4ee6
e4580f0
a583a10
ddac788
156eaaf
16d5d5a
ae97940
21d435d
a78717f
4bca72c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,14 @@ type VisibleFlag interface { | |
IsVisible() bool | ||
} | ||
|
||
// CategorizableFlag is an interface that allows us to potentially | ||
// use a flag in a categorized representation. | ||
type CategorizableFlag interface { | ||
VisibleFlag | ||
|
||
GetCategory() string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to just Category(). golang doesnt recommend using GetXXX There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the conflict with the field name |
||
} | ||
|
||
func flagSet(name string, flags []Flag) (*flag.FlagSet, error) { | ||
set := flag.NewFlagSet(name, flag.ContinueOnError) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt f.m already sorted ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC ranging over a
map
has undefined sort order: https://go.dev/play/p/aR7JKg4ae8r Or did you mean something else? 🤔