|
#!/usr/bin/env coffee
exec = require('child_process').exec
readline = require 'readline'
# Send something to nailgun and format the result.
send_to_repl = (str) ->
child = exec "/home/lu/t/vim/clojure/client/ng vimclojure.Nail Repl -r",
(err, stdout, stderr) ->
if(err)
console.log err
exit 1
answer = JSON.parse stdout
process.stdout.write answer.stdout
if answer.stderr isnt ""
process.stderr.write answer.stderr
rl.prompt()
child.stdin.write str
child.stdin.end()
console.log "o'rly 0.x (clojure repl with a nailgun)"
rl = readline.createInterface process.stdin, process.stdout
rl.setPrompt "> "
rl.prompt()
rl.on 'line', (cmd) ->
send_to_repl cmd
|