Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An async ARGV node.js parser
branch: master

Merge pull request #1 from node-migrator-bot/clean

Hi! I fixed some calls to "sys" for you!
latest commit a9a5924ec0
Andrea Brancaleoni authored


An async ARGV parser


  $ [sudo] npm install aparser -g


var aparser = require('aparser');
var puts = require('util').puts

/* aparser object it's an instance of EventEmitter */

/* example with modifier, 
   if the string after -g it's another modifier the -g itself it's turned in a argument without minus symbol
aparser.on('-g', function(arg, index) {
  puts('the string with -g modifier is '+arg);  

/* example with a command */
aparser.on('start', function(arg, index) {
  puts('script '+arg+'ed');

/* example with a simple argument 
   'argument' event it's a command catch-all
aparser.on('argument', function(arg, index) {
  puts('the '+index+' argument is'+ arg);


then executing it

  $ node -g ciao start
  the string with -g modifier is ciao
  script started
  the 3 argument is start

Author: Andrea Brancaleoni

Something went wrong with that request. Please try again.