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

Confirm prompt should optionally allow "Always". #450

Open
malthe opened this issue Jan 25, 2024 · 0 comments
Open

Confirm prompt should optionally allow "Always". #450

malthe opened this issue Jan 25, 2024 · 0 comments

Comments

@malthe
Copy link

malthe commented Jan 25, 2024

In an interactive session, often we're prompted over and over again for the same class of prompt. It would be useful to be able to have Y/n/A, where "A" is always (or "Yes, to all".)

I came here from pnpm/pnpm#6778 which has the following prompt:

 if (opts.confirmModulesPurge ?? true) { 
   const confirmed = await enquirer.prompt({ 
     type: 'confirm', 
     name: 'question', 
     message: importers.length === 1 
       ? `The modules directory at "${importers[0].modulesDir}" will be removed and reinstalled from scratch. Proceed?` 
       : 'The modules directories will be removed and reinstalled from scratch. Proceed?', 
     initial: true, 
   }) 

Adding support for an always option would entail some sort of callback to take a special action if the user selected this option, e.g.

always: () => { opts.confirmModulesPurge = true }
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