Преглед на файлове

~/.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