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

Feat: support for disabled Add Option to Disable "Select All" and "Deselect All" Shortcuts in Checkbox Prompt #1648

Open
mzc9915 opened this issue Jan 17, 2025 · 1 comment

Comments

@mzc9915
Copy link

mzc9915 commented Jan 17, 2025

I have a use case where I want to disable the "Select All" and "Deselect All" shortcuts (triggered by the "a" and "i" keys) in the checkbox prompt.

Currently, there doesn't seem to be a built-in option to disable these shortcuts, and I have to resort to custom event handling to achieve this. It would be beneficial to have a configuration option that allows developers to disable or customize these keyboard shortcuts directly.

Feature Request:

Add a new configuration option to the checkbox prompt, such as:

{
  type: 'checkbox',
  name: 'selection',
  message: 'Select items:',
  choices: [],
  disableSelectAll: true, // New option to disable the 'a' and 'i' keys
}

This feature would provide more flexibility for developers who want finer control over the user interaction in their CLI applications.

Thank you for considering this enhancement!

@SBoudrias
Copy link
Owner

Thanks for bringing up this idea. I think it does make sense to add a way to customize this.

Flexibility wise, how about we expose a way to customize or turn off shortcuts; something like

await checkbox({
    ...opt,
    shortcuts: {
        all: 'a', // customize the key
        invert: null, // disable the shortcut
    }
});

PR welcomed if anyone wanna implement this.

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

No branches or pull requests

2 participants