SBoudrias / Inquirer.js

A collection of common interactive command line user interfaces.
MIT License
20.29k stars 1.3k forks source link

[Feature request]: Allow to fill default value during prompt #1125

Closed comatory closed 2 years ago

comatory commented 2 years ago

I'm working on application where this would be desirable and editor prompt doesn't feel natural to use. Would it possible to somehow autocomplete default value for some question when hitting some key, ideally TAB? My application is using inquirer to create new records but also to edit them. At the moment when record is being edited, I can show previously filled value with default option which is good but if I want to use this default value and just fix one word, I have to re-type it.

Otherwise great work on this package!

SBoudrias commented 2 years ago

Hey @comatory, I think this use case is a bit narrow to your specific needs. I would recommend creating a custom prompt to do this for your use case.

To do that, you have 2 options:

  1. Follow/Replicated how other plugins have been created https://github.com/SBoudrias/Inquirer.js#plugins
  2. Checkout the beta prompts relying on @inquirer/core to reimplement a custom prompt. This interface IMO is easier to use; but it is still beta/being developed. And it cannot be integrated with the current version of inquirer (but would unlikely need to be.)