Skip to content

Commit

Permalink
Merge pull request #77 from orthlieb/master
Browse files Browse the repository at this point in the history
Fix issue #56 where options parsing strips off arguments that it shouldn't
  • Loading branch information
tj committed Aug 3, 2012
2 parents 7234489 + d65dabd commit 4f1ddc1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ Command.prototype.action = function(fn){
self.unknownOption(parsed.unknown[0]);
}

// Leftover arguments need to be pushed back onto the args stack
// Fixes issue #56
if (parsed.args.length > 0) {
args = parsed.args.concat(args);
}

self.args.forEach(function(arg, i){
if (arg.required && null == args[i]) {
self.missingArgument(arg.name);
Expand Down

0 comments on commit 4f1ddc1

Please sign in to comment.