impulse-bin
node.js CLI module runner
- Adapters for commander.js and node-optimist
- Basic set of long-con console loggers for stdout/stderr/verbose with color
Purpose
- CLI scripts that are easier to test without running the executable.
- Reduce boilerplate.
Example
bin/myproj
Executables are reduced to thin loading calls.
var bin = ;bin; // Or if your CLI module's run() function is a generator:bin;
lib/cli/myproj.js
While the rest is separated into input parsing and input consumption.
init()
receives a CLI inputprovider
likecommander.js
ornode-optimist
for you to configure.run()
receives the parsedthis.options
andthis.args
from theprovider
.
exports { provider;}; exports { this; this; // ...};
bin/myproj
to the lib/cli/myproj.js
Pass arguments from // bin/myprojbin; // lib/cli/myproj.jsexports { console; // [1, 2, 3]};
Installation
NPM
npm install impulse-bin
Documentation
License
MIT
Tests
npm test