Module: Mpex::Interactive

Defined in:
lib/mpex/interactive.rb

Class Method Summary collapse

Class Method Details

.runObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mpex/interactive.rb', line 6

def self.run
  puts "Welcome to MPEx.rb shell. Type 'help' and 'help [command]' to get a help or 'quit' to exit."
  puts "Donations welcome: 1DrqwLjksrXZHdSzzieaNhQuhrnbNTeiQr"
  puts "Type 'irc' to connect to Freenode to use MPEx IRC bots"
  loop do
    line = ask("mpex>> ") {|q| q.readline = true }

    next if line.empty?

    exit 0 if line =~ /^(exit|quit|q)$/

    args = line.split(" ") + ["--isinteractive"]

    begin
      Mpex::CLI.command.run(args) unless args.empty?
    rescue Exception => ex
      puts ex
    end
  end
end