Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow js to be passed in via stdin

  • Loading branch information...
commit 241d556c0c1b6744053689be4f07d95807fa8d69 1 parent 46e0983
Steve Howell authored
Showing with 15 additions and 4 deletions.
  1. +15 −4 command_line.coffee
View
19 command_line.coffee
@@ -4,7 +4,9 @@ fs = require 'fs'
file_lines = (fn) ->
fs.readFileSync(fn).toString().split '\n'
-list = (matches, cs_lines, js_lines) ->
+list = (cs_lines, js_lines) ->
+ matches = source_line_mappings cs_lines, js_lines
+
snippet = (lines, start, end, prefix) ->
for ln in [start...end]
line = lines[ln]
@@ -25,6 +27,15 @@ list = (matches, cs_lines, js_lines) ->
do ->
[ignore, ignore, cs_file, js_file] = process.argv
cs_lines = file_lines(cs_file)
- js_lines = file_lines(js_file)
- matches = source_line_mappings cs_lines, js_lines
- list matches, cs_lines, js_lines
+
+ if js_file == '-'
+ data = ''
+ stdin = process.openStdin()
+ stdin.on 'data', (buffer) ->
+ data += buffer.toString() if buffer
+ stdin.on 'end', ->
+ js_lines = data.split '\n'
+ list cs_lines, js_lines
+ else
+ js_lines = file_lines(js_file)
+ list cs_lines, js_lines
Please sign in to comment.
Something went wrong with that request. Please try again.