Created
October 14, 2010 18:34
-
-
Save troufster/626744 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var args = process.argv.slice(2); | |
var exargs = { | |
'-a' : function(val) { | |
if(!val) return; | |
console.log('Arg a does stuff with ' + val); | |
}, | |
'-b' : function() { | |
console.log('arg b in da house'); | |
}, | |
'-c' : function() { | |
console.log('arg c represent'); | |
} | |
}; | |
for (var arg in exargs) { | |
var argindex = args.indexOf(arg); | |
if(argindex != -1) { | |
exargs[arg](args[argindex+1]); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment