
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Command-line Questions & Answers. Supports color formatting, lists, yes/no confirmations.
$ npm install cli-qa
var NewQA = require('cli-qa')
var QA = NewQA()
QA.ask("{white}Name:{reset}")
QA.ask({ title: "Username:", default: process.env.USER })
QA.ask({ key: "email", title: "E-Mail:", expect: { email: true } })
QA.ask({ title: "{red}Favorite foods:{reset}", list: 3 })
QA.ask({ key: "books", title: "{white}Favorite books:{reset}", list: true })
QA.ask({ title: "{yellow}Favorite {green}Fruits{reset}:", commaList: true })
QA.ask({ key: 'thatsAll', title: "{yellow}That's all, {name}? (yes/no){reset}", yesno: true })
QA.start(function (answers) {
console.log(answers)
// => {
// "name": "Azer",
// "username": "ak",
// "email": "azer@roadbeats.com",
// "foods": ["falafel", "babi guling", "kebab"],
// "favoriteBooks": ["snow", "white castle"],
// "thoughts": "let's go somewhere!",
// "thatsAll": true
// }
})
The list of available options for each question:
The key that will be used in the answers object. If not specified, it'll be auto-generated
Title of the question. styling accepted.
If a numeric value is passed, user will be prompted to enter a list with expected number of lines. If true passed, the list input won't be limited.
Specify "true" if a comma-separated list is expected as an answer
Yes/no question? true/false
Default value if answer is empty.
Specify requirements for validating the user input.
Async validation function. See tests for example.
FAQs
This package name is not currently in use, but was formerly occupied by a popular package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.
The npm package cli-qa receives a total of 11 weekly downloads. As such, cli-qa popularity was classified as not popular.
We found that cli-qa demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.