Updates shell.js to v0.1.2

This commit is contained in:
Yury Delendik 2013-03-07 10:32:16 -06:00
parent 0e14f0ccae
commit 0a27f18bfe
6 changed files with 923 additions and 339 deletions

View file

@ -1,4 +1,5 @@
require('./global');
config.fatal = true;
global.target = {};
@ -6,6 +7,7 @@ global.target = {};
// been evaluated
var args = process.argv.slice(2);
setTimeout(function() {
var t;
if (args.length === 1 && args[0] === '--help') {
console.log('Available targets:');
@ -24,7 +26,7 @@ setTimeout(function() {
return;
oldTarget.done = true;
return oldTarget.apply(oldTarget, arguments);
}
};
})(t, target[t]);
}
@ -32,7 +34,7 @@ setTimeout(function() {
// Execute desired targets
if (args.length > 0) {
args.forEach(function(arg) {
if (arg in target)
if (arg in target)
target[arg]();
else {
console.log('no such target: ' + arg);