1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

fixing bug in option parsing with flagged arguments and cake.

This commit is contained in:
Jeremy Ashkenas 2010-07-11 17:55:22 -04:00
parent be8d812919
commit 4bd657160d
3 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@
for (_c = 0, _e = _d.length; _c < _e; _c++) {
rule = _d[_c];
if (rule.shortFlag === arg || rule.longFlag === arg) {
options[rule.name] = rule.hasArgument ? args[i + 1] : true;
options[rule.name] = rule.hasArgument ? args[i += 1] : true;
matchedRule = true;
break;
}

View file

@ -30,7 +30,7 @@ exports.OptionParser: class OptionParser
matchedRule: no
for rule in @rules
if rule.shortFlag is arg or rule.longFlag is arg
options[rule.name]: if rule.hasArgument then args[i + 1] else true
options[rule.name]: if rule.hasArgument then args[i: + 1] else true
matchedRule: yes
break
throw new Error "unrecognized option: $arg" if isOption and not matchedRule

View file

@ -16,5 +16,5 @@ result: opt.parse ['--optional', '-r', 'folder', 'one', 'two']
ok result.optional is true
ok result.required is 'folder'
ok result.arguments.join(' ') is 'folder one two'
ok result.arguments.join(' ') is 'one two'