Skip to content

Conversation

tjerkw
Copy link

@tjerkw tjerkw commented Feb 13, 2023

Makes it easier to use a subset of enum values for a certain enum as a Choice ArgType

Makes it easier to use a subset of enum values for a certain enum as a Choice ArgType
Copy link
Member

@ilya-g ilya-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this new feature requires tests, a positive and a negative one (e.g. failing on a value not belonging to the subset)

* Helper for arguments that have limited set of possible values represented as enumeration constants.
*/
inline fun <reified T : Enum<T>> Choice(
values: List<T> = enumValues<T>().toList(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other similar overload such list is called choices

This makes it easier to use the commands, cause it will print the help text when you set printHelpOnEmptyArgs = true
Allow passing printHelpOnEmptyArgs to ArgParser
Use choices, update toVariant
@tjerkw
Copy link
Author

tjerkw commented Feb 15, 2023

I believe this new feature requires tests, a positive and a negative one (e.g. failing on a value not belonging to the subset)

I agree, but dont have the time/resources todo that now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants