Commander file
Receive file/uri and stdin at commander.js
- Fetch data after parse via first argument or
--stdin
. - First argument always return the file.
Usage
$ npm install commander-file --save
./program.js
#!/usr/bin/env node var program = ;programversion'0.0.0';
$ node program.js --help# # Usage: program <file/url> dostaff [options...] # # Options: # # -h, --help output usage information # -S, --stdin use the stdin # -V, --version output the version number # stdin $ echo -n 'foo' | node program.js --stdin dostaff# foo # null # dostaff $ node program.js bar.txt dostaff# bar # bar.txt # dostaff # uri $ node program.js http://example.com/baz.txt dostaff# baz # http://example.com/baz.txt # dostaff