Skip to content

Commit afba9ca

Browse files
committed
Allow specifying output file on command line.
1 parent b1d5710 commit afba9ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/JSLint.coffee

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ catch e
2727
console.error JSON.stringify {errors:[{id:"INVALIDJSON"}]}
2828
process.exit 1
2929

30+
if process.argv.length > 4
31+
outputFilename = process.argv[4]
32+
else
33+
outputFilename = "#{filename}.adsafe.js"
34+
3035
details = null
3136
re = /\/\*\![A-Z_]+([\s\S]+)\*\//
3237
script = script.replace re, (header) ->
@@ -294,5 +299,5 @@ unless ok
294299
else
295300
script = script.substr(head.length, script.length - (head.length+foot.length))
296301
script = "new ADSAFE_APP(#{id}, \"#{adsafeId}\", #{JSON.stringify(details)}, function(ADSAFE){\n#{script}\n});"
297-
fs.writeFileSync "#{filename}.adsafe.js", script
302+
fs.writeFileSync outputFilename, script
298303
process.exit 0

0 commit comments

Comments
 (0)