Skip to content
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

Support group exclusive selections in inquirer.checkbox and inquirer.select workflows. #68

Open
pete312 opened this issue Jun 21, 2023 · 0 comments

Comments

@pete312
Copy link

pete312 commented Jun 21, 2023

Feature request : group exclusive selections.

relating to the SO question about this.

https://stackoverflow.com/questions/76525077/how-to-mutualy-exclude-choices-in-inquirerpy?noredirect=1#comment134928834_76525077

Basically a great feature to add would be a workflow to un-toggle options in a Choice list which are in a mutually exclusive group. I.e. as user selects an option, it toggles off any other selected option in its grouping. This would be intuitive to the user and would simplify any validation.

This could be an option on the Choice.

     choices = [
          Choice("warning", name="Important only",   exclusive_group='verbosity'),
          Choice("info", name="Informational",             exclusive_group='verbosity'),
          Choice("verbose", name="Verbose",                exclusive_group='verbosity')
          Separator(),
          Choice("paging",       name="Paged output",    exclusive_group='preferences'),
          Choice("stream",     name="Stream output",  exclusive_group='preferences')
     ]

     display_settings = inquirer.checkbox(
                message="Select display settings:",
                choices=choices,
                invalid_message="just select 1 from each section                 ",
                validate=display_setting_validation            
            ).execute()

This would have 2 multi select menus for the user, making 2 values in the display_settings list. example ["warning", "paging"]

@pete312 pete312 changed the title Support group excludive selections in inquirer.checkbox and inquirer.select workflows. Support group exclusive selections in inquirer.checkbox and inquirer.select workflows. Jun 21, 2023
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

No branches or pull requests

1 participant