Skip to content

Commit

Permalink
ADD: default values in command line inquirer
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak25 committed May 27, 2023
1 parent 868a8ed commit e4cfeb2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/consoleIO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ export class ConsoleIO {
* @param question
* @returns Promise<string>
*/
async ask(question: string) {
return Inquirer.ask(question);
async ask(question: string, defaultVal?: string) {
return Inquirer.ask(question, defaultVal);
}

/**
Expand All @@ -152,25 +152,30 @@ export class ConsoleIO {
* @param choices
* @returns Promise<string>
*/
async select(question: string, choices: string[], multiple = false) {
return Inquirer.select(question, choices, multiple);
async select(
question: string,
choices: string[],
multiple = false,
defaultVal?: string[]
) {
return Inquirer.select(question, choices, multiple, defaultVal);
}

/**
* Use this method to ask for confirmation from the client
* @param question
* @param message
*/
async confirm(question: string) {
return Inquirer.confirm(question);
async confirm(message: string, defaultVal?: boolean) {
return Inquirer.confirm(message, defaultVal);
}

/**
* Use this method to ask for a password/hidden input from the client
* @param question
* @param mask
*/
async password(question: string, mask = "") {
return Inquirer.password(question, mask);
async password(question: string, mask = "", defaultVal?: string) {
return Inquirer.password(question, mask, defaultVal);
}

/**
Expand Down

0 comments on commit e4cfeb2

Please sign in to comment.