Permalink
Browse files

In case the default value of a parameter is an array, append values t…

…hat the user passes on the command line into the array. Allows stuff like: $ node script.js --file=FILE1 --file=FILE2 --file=FILE3 ...
  • Loading branch information...
1 parent 51794a9 commit b61a494cbcac16febf48d8c481b9d07dd73b3586 @dhruvbird dhruvbird committed Oct 31, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 index.js
View
@@ -118,7 +118,11 @@ Object.defineProperty(tav, "set", {
value = parseFloat(value);
}
}
- self[name] = value;
+ if (self[name] instanceof Array) {
+ self[name].push(value);
+ } else {
+ self[name] = value;
+ }
} else {
// Just argument
self.args.push(chunk);

0 comments on commit b61a494

Please sign in to comment.