-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconsole
More file actions
executable file
·37 lines (30 loc) · 884 Bytes
/
console
File metadata and controls
executable file
·37 lines (30 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/setup"
require "grumlin"
require "irb"
require "irb/completion"
require "dead_end"
Grumlin.configure do |config|
config.url = ENV.fetch("GREMLIN_URL", "ws://localhost:8182/gremlin")
end
class Repository
extend Grumlin::Repository
def start_irb
IRB.setup(nil)
IRB.conf[:PROMPT][:DEFAULT] = { PROMPT_I: "%N(main):%03n:%i> ",
PROMPT_N: "%N(main):%03n:%i> ",
PROMPT_S: "%N(main):%03n:%i%l ",
PROMPT_C: "%N(main):%03n:%i* ",
RETURN: "=> %s\n" }
workspace = IRB::WorkSpace.new(binding)
irb = IRB::Irb.new(workspace)
IRB.conf[:MAIN_CONTEXT] = irb.context
irb.eval_input
end
end
Async do
Repository.new.start_irb
ensure
Grumlin.close
end