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

making it possible to pass in command-line arguments to a hash-banged coffee script. Ticket #473

This commit is contained in:
Jeremy Ashkenas 2010-07-10 15:36:54 -04:00
parent 15a2b7d69a
commit 3d6cdfa636
2 changed files with 10 additions and 3 deletions

View file

@ -39,6 +39,10 @@
flags = sources.slice((separator + 1), sources.length);
sources = sources.slice(0, separator);
}
if (options.run) {
flags = sources.slice(1, sources.length + 1).concat(flags);
sources = [sources[0]];
}
process.ARGV = (process.argv = flags);
return compileScripts();
};

View file

@ -57,6 +57,9 @@ exports.run: ->
if separator >= 0
flags: sources[(separator + 1)...sources.length]
sources: sources[0...separator]
if options.run
flags: sources[1..sources.length].concat flags
sources: [sources[0]]
process.ARGV: process.argv: flags
compileScripts()