An input prompt implementation for Inquirer that provides some advanced features.
Out of the box, this prompt works just like the input
prompt.
This is work in progress - I'm using it to improve the user experience of Terminal AI. Things may not work as expected. When the API stabalises and is well-tested then the demo will be updated and linked back to the original project.
npm install @dwmkerr/advanced-input-prompt
The hint
parameter shows a hint below the input prompt. As soon as the user starts typing, the hint is hidden:
import prompt from "./advanced-input-prompt";
async function demo() {
const answer = await prompt({
message: "Enter your input (required):",
hint: "<Enter> Show Menu",
required: true,
validate: (input: string) => input.trim() !== "" || "Input cannot be empty",
});
console.log(`User input: ${answer1}`);
}
(async () => {
await demo();
})();
Clone the repo, install dependencies and use npm start
to run the demo:
git clone git@github.com:dwmkerr/inquirer-advanced-input-prompt
cd inquirer-advanced-input-prompt
npm install
npm start