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:
parent
be8d812919
commit
4bd657160d
3 changed files with 3 additions and 3 deletions
|
@ -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'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue