Minimal Prompt
A library for creating command-line interfaces and harvesting information from them.
Installation
npm install minimal-prompt --save
Usage
prompt.question(questions, options)
Used to prompt the user with a specific set of questions and get their answers to each one.
Arguments
questions
(array): The set of questions to prompt the user with.options
(object): An object describing the behavior of the prompt.
Options
prompt
(string): A string to begin each input line with.delimiter
(string): A string to separate the prompt from the user input.onComplete
(function): The function invoked when all questions are complete.formatPrompt
(function): A function to format the prompt.formatPrompt(prompt, delimiter, name)
prompt
(string): The specified prompt string.delimiter
(string): The specified delimter string.name
(string): If using aquestion
prompt, the question being asked. (Only available for a question prompt)
Example
var prompt = ; prompt; // prompt.start() will begin the prompting process.promptstart;
prompt.repeat(options)
Used to repeatedly prompt the user for information using the same prompt.
Arguments
options
(object): An object describing the behavior of the prompt.
Options
prompt
(string): A string to begin each input line with.delimiter
(string): A string to separate the prompt from the user input.onLine
(function): The function invoked when a new line of input is ready.formatPrompt
(function): A function to format the prompt.formatPrompt(prompt, delimiter)
prompt
(string): The specified prompt string.delimiter
(string): The specified delimter string.
Example
var prompt = ; prompt; // prompt.start() will begin the prompting process.promptstart;