@bndynet/cli
v1.5.1
Published
Powerful command line interface for interactive...
Downloads
317
Maintainers
Readme
cli.js
Powerful command line helpers for interactive Node.js scripts.
Install
npm i @bndynet/cliUsage
const cli = require('@bndynet/cli');
cli.info('Starting...');
cli.success({ ok: true });The package exports:
- logging helpers:
print,log,info,warn,success,error - prompt helpers:
input,confirm,select,questions,suggest,ask - terminal helpers:
beginRun,beginReadFile,readFile,writeFile,replaceFileContent - progress helpers:
progress,Progress - text styles:
styles
Prompt Example
const cli = require('@bndynet/cli');
async function main() {
const answers = await cli.questions([
'Please input your name:',
'Home page is online?',
['Your country:', ['China', '', 'US']],
['Choose or type user name::', ['Bendy', 'Joyce']],
]);
cli.success(answers);
}
main();Development
Install dependencies and build once before running the demos:
npm install
npm run buildAvailable demo commands:
npm test: build the project and run the default log demonpm run test:log: log output demonpm run test:io: shell command/spinner demonpm run test:progress: progress bar demonpm run test:question: interactive prompt demonpm start: watch buildnpm run docs: generate API docs
Screenshots


