mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
fixing bug in option parsing with flagged arguments and cake.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user