Skip to content

Commit

Permalink
fixes #1752: passing POSIX-style arguments to scripts through the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed Oct 6, 2011
1 parent cf996d2 commit e686e3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/coffee-script/optparse.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/optparse.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ exports.OptionParser = class OptionParser
# for interpreting the options object.
parse: (args) ->
options = arguments: [], literals: []
args = normalizeArguments args
originalArgs = args
args = normalizeArguments args
for arg, i in args
if arg is '--'
options.literals = args[(i + 1)..]
options.literals = originalArgs[(1 + originalArgs.indexOf '--')..]
break
isOption = !!(arg.match(LONG_FLAG) or arg.match(SHORT_FLAG))
matchedRule = no
Expand All @@ -40,7 +41,7 @@ exports.OptionParser = class OptionParser
break
throw new Error "unrecognized option: #{arg}" if isOption and not matchedRule
if not isOption
options.arguments = args.slice i
options.arguments = originalArgs[(originalArgs.indexOf arg)..]
break
options

Expand Down

0 comments on commit e686e3f

Please sign in to comment.