1.0.0 • Published 9 years ago

@unumux/autorelease-test v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 years ago

UX-Questions

A library for creating CLI questions using Inquirer Promisify

travis build codecov coverage npm version

yesNo(question, defaultAns) => promise

Ask a yes or no question

Parameters

NameTypeDescription
questionstring"Do you like cheese?"
defaultAnsbooleandefault = true

Returns

TypeDescription
promiseThe user's answer {boolean} if fulfilled, or an error if rejected.

Examples

// returns user's answer as boolean or default answer
yesNo("Do you like cheese?");

// returns user's answer as boolean or default answer
yesNo("Do you hate cheese?", false);

Source: index.js, line: 24


text(question, defaultAns) => promise

Ask an open-ended question

Parameters

NameTypeDescription
questionstring"What's your name?"
defaultAnsstringdefault = null

Returns

TypeDescription
promiseThe user's answer {string} if fulfilled, or an error if rejected.

Examples

// returns user's answer as string or default answer
text("What is your name?");

Source: index.js, line: 44


password(question, defaultAns) => promise

Ask for a password

Parameters

NameTypeDescription
questionstring"What's your password?"
defaultAnsstringdefault = null

Returns

TypeDescription
promiseThe user's answer {string} if fulfilled, or an error if rejected.

Examples

//returns user's answer as string or default answer
password("What is your password?");

Source: index.js, line: 61


list(question, choices, defaultAns) => promise

Ask a question with multiple choices that accepts one answer

Parameters

NameTypeDescription
questionstring"Which of these is your favorite color? (mark all that apply)"
choicesarray"red", "blue", "yellow"
defaultAnsstringdefault = array0

Returns

TypeDescription
promiseThe user's answer {string} if fulfilled, or an error if rejected.

Examples

//returns user's answer as string or default answer 
list("Which is your favorite color?", ["red", "blue", "yellow"]);

Source: index.js, line: 78


checkbox(question, choices) => promise

Ask a question with multiple choices that accepts one or more answers

Parameters

NameTypeDescription
questionstring"Which one of these is your favorite color?"
choicesarray"red", "blue", "yellow"

Returns

TypeDescription
promiseThe user's answer(s) {array of strings} if fulfilled, or an error if rejected.

Examples

//returns user's answer(s) as an array of strings
checkbox("Which places have you visited?", ["Columbia, SC", "Charlotte, NC", "Manchester, England"]);

Source: index.js, line: 97