瀏覽代碼

~/.bin/rly: A rly cool little clojure shell (super α stage but still)

It's written in coffeescript/node because that starts fast enough and
isn't too painful. :)
It uses the nailgun repl and is thus quite faaast (even for lots of console
outputs). Tadum, tadum, now for some features...
Lucas Stadler 14 年之前
父節點
當前提交
e710e628c2
共有 1 個文件被更改,包括 29 次插入0 次删除
  1. 29 0
      .bin/rly

+ 29 - 0
.bin/rly

@ -0,0 +1,29 @@
1
#!/usr/bin/env coffee
2
3
exec = require('child_process').exec
4
readline = require 'readline'
5
6
# Send something to nailgun and format the result.
7
8
send_to_repl = (str) ->
9
	child = exec "/home/lu/t/vim/clojure/client/ng vimclojure.Nail Repl -r",
10
		(err, stdout, stderr) ->
11
			if(err)
12
				console.log err
13
				exit 1
14
15
			answer = JSON.parse stdout
16
			process.stdout.write answer.stdout
17
			if answer.stderr isnt ""
18
				process.stderr.write answer.stderr
19
			rl.prompt()
20
21
	child.stdin.write str
22
	child.stdin.end()
23
24
console.log "o'rly 0.x (clojure repl with a nailgun)"
25
rl = readline.createInterface process.stdin, process.stdout
26
rl.setPrompt "> "
27
rl.prompt()
28
rl.on 'line', (cmd) ->
29
	send_to_repl cmd