PATH:
usr
/
local
/
lib
/
node_modules
/
bower
/
lib
/
node_modules
/
optimist
/
example
#!/usr/bin/env node var argv = require('optimist') .usage('Count the lines in a file.\nUsage: $0') .demand('f') .alias('f', 'file') .describe('f', 'Load a file') .argv ; var fs = require('fs'); var s = fs.createReadStream(argv.file); var lines = 0; s.on('data', function (buf) { lines += buf.toString().match(/\n/g).length; }); s.on('end', function () { console.log(lines); });
[-] reflect.js
[edit]
[-] xup.js
[edit]
[-] bool.js
[edit]
[+]
..
[-] default_hash.js
[edit]
[-] string.js
[edit]
[-] usage-options.js
[edit]
[-] divide.js
[edit]
[-] short.js
[edit]
[-] line_count_options.js
[edit]
[-] nonopt.js
[edit]
[-] line_count_wrap.js
[edit]
[-] default_singles.js
[edit]
[-] boolean_single.js
[edit]
[-] boolean_double.js
[edit]
[-] line_count.js
[edit]