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:
parent
15a2b7d69a
commit
3d6cdfa636
2 changed files with 10 additions and 3 deletions
|
@ -39,6 +39,10 @@
|
||||||
flags = sources.slice((separator + 1), sources.length);
|
flags = sources.slice((separator + 1), sources.length);
|
||||||
sources = sources.slice(0, separator);
|
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);
|
process.ARGV = (process.argv = flags);
|
||||||
return compileScripts();
|
return compileScripts();
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,6 +57,9 @@ exports.run: ->
|
||||||
if separator >= 0
|
if separator >= 0
|
||||||
flags: sources[(separator + 1)...sources.length]
|
flags: sources[(separator + 1)...sources.length]
|
||||||
sources: sources[0...separator]
|
sources: sources[0...separator]
|
||||||
|
if options.run
|
||||||
|
flags: sources[1..sources.length].concat flags
|
||||||
|
sources: [sources[0]]
|
||||||
process.ARGV: process.argv: flags
|
process.ARGV: process.argv: flags
|
||||||
compileScripts()
|
compileScripts()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue