0.0.5 • Published 10 years ago

commander-file v0.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

Commander file NPM version Build Status Coverage Status

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 = require('commander-file');
program
.version('0.0.0')
.usage('<file/url> dostaff [options...]')
.parse(process.argv).then(function(data){
  console.log(data);
  console.log(program.args[0]);
  console.log(program.args[1]);
});
$ 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

License

MIT

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago

0.0.0-beta.0

10 years ago

0.0.0-alpha.3

10 years ago

0.0.0-alpha.2

10 years ago

0.0.0-alpha.1

10 years ago

0.0.0-alpha.0

10 years ago