Explorar el Código

~/.bin/rly: Goodbye, it was a fun time! But then came jark.

Use <http://icylisper.in/jark/>, it's better (multiple vms running,
classpath changing on runtime, etc) and it has two patches from me. :)
Lucas Stadler %!s(int64=14) %!d(string=hace) años
padre
commit
b50ad8071c
Se han modificado 1 ficheros con 0 adiciones y 61 borrados
  1. 0 61
      .bin/rly

+ 0 - 61
.bin/rly

@ -1,61 +0,0 @@
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 #{process.argv[2..].join " "} -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
get_completion_for = (str, cb) ->
25
	relevant_match = str.match(/[a-zA-Z][a-zA-Z0-9\-\?]+$/)
26
	if relevant_match
27
		relevant = relevant_match[0]
28
	else
29
		cb null, [[], str]
30
		return
31
32
	exec "/home/lu/t/vim/clojure/client/ng vimclojure.Nail Complete --base #{relevant}",
33
		(err, stdout, stderr) ->
34
			if(err)
35
				console.log err
36
				exit 1
37
38
			answer = JSON.parse stdout
39
			matches = (m.word for m in answer.value)
40
			cb null, [matches, str]
41
42
is_balanced = (str) ->
43
	n = 0
44
	for c in str
45
		n += 1 if c in "([\""
46
		n -= 1 if c in ")]\""
47
	n == 0
48
49
console.log "o'rly 0.x (clojure repl with a nailgun)"
50
rl = readline.createInterface process.stdin, process.stdout, get_completion_for
51
rl.setPrompt "> "
52
rl.prompt()
53
cmplt = ""
54
rl.on 'line', (cmd) ->
55
	cmd = cmplt + cmd
56
	if is_balanced cmd
57
		send_to_repl cmd
58
		cmplt = ""
59
	else
60
		cmplt = cmd
61
		rl.write("  ")