-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add ChoiceFlag #1234
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 ChoiceFlag #1234
Conversation
dearchap
left a comment
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.
Great good.
|
I just realised. This is more generic than enums. You could implement an option of choices for strings, ints, etc for this. Maybe rename this to ChoiceFlag ? |
added EnumByName to Context -> Context.Enum renamed flag_enum.go to flag_choice.go
Yeah, that sounds better. |
|
@dearchap Regarding adding a Destination. |
improved ChoiceFlag api
|
I added destination to the ChoiceFlag and improved its API. |
dearchap
left a comment
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.
You should also write some unit tests for this for completion.
|
I did some changes to the ChoiceFlag;
|
marcofranssen
left a comment
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.
We might also want to update the README.md with usage example and documenting the availabiltiy of this param type.
|
What is the state of this PR? Seems only blocked on some missing code coverage for the new feature. @Poweranimal is that something you could finalize? |
|
Hi @marcofranssen Thus, I got the impression that this project is EOL and doesn't welcome pr's anymore. |
|
@Poweranimal , you did great job. I hope better response from maintainers |
|
@Poweranimal Hello and sorry for the long delay 😭 Please come back! This whole global pandemic thing and various maintainers' life adventures have seriously impacted responsiveness, but we're trying to get stuff flowing again now. |
|
Connected to #602 |
|
@Poweranimal if you could rebase this onto the current Edit to add: rebase and add some tests to this, both for codecov happiness reasons as well as that having tests is usually a good thing. Thanks! :D |
|
Hi @jalavosus , |
|
@meatballhat I think this is a good feature but there are many ways to go about it. Either the ChoiceFlag as given here or a Choice interface can be added to each flag(IntFlag, StringFlag etc) in the generated code. I am inkling towards the latter approach. I can work on it if you think its the right direction. |
|
@dearchap I would love to see what you have in mind for a Choice interface! |
|
This approach has been considered but dropped due to favoring a different mechanism using a validation API. That would allow ALL flags to use validation code instead of creating a new Flag |
A cli flag used for enums.
The flag displays all possible enum variations in the cli's help message and verifies the provided input value.
What type of PR is this?
What this PR does / why we need it:
This PR adds an enum flag implementation.
Special notes for your reviewer:
I'm open for any suggestion to fulfill the job of supporting an enum flag better.
Example
Release Notes
TODOS