Class: Recot::Commands::InteractiveUi

Inherits:
Object
  • Object
show all
Defined in:
lib/recot/commands/interactive_ui.rb

Instance Method Summary collapse

Constructor Details

#initializeInteractiveUi

Returns a new instance of InteractiveUi.



11
12
# File 'lib/recot/commands/interactive_ui.rb', line 11

def initialize
end

Instance Method Details

#destroyObject



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/recot/commands/interactive_ui.rb', line 41

def destroy
  loop do
    print "Sure you want to delete all the files? [y/N] > "
    input_str = STDIN.gets.chomp
    case input_str
    when /^y$/
      Utils::RecotUtil.remove
      puts "Removed all the files and cache."
    else
    end
    break
  end
end


55
56
57
58
59
60
61
62
63
64
# File 'lib/recot/commands/interactive_ui.rb', line 55

def print_banner
  puts "Start recot ver #{Recot::VERSION}"
  puts ""
  puts '    ____                  __'
  puts '   / __ \___  _________  / /'
  puts '  / /_/ / _ \/ ___/ __ \/ __/'
  puts ' / _, _/  __/ /__/ /_/ / /'
  puts '/_/ |_|\___/\___/\____/\__/'
  puts ""
end

#startObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/recot/commands/interactive_ui.rb', line 14

def start
  print_banner()

  count = 1
  loop do

    print "[#{count}](recot) > "
    input_str = STDIN.gets.chomp
    case input_str
    when /[Ee]xit/
      break
    when /[Cc]ancel/
      # Cancel recent evidence.
      RecentCancel.cancel
    when /[Cc]lear/
      # Clear current test no.
      CurrentClear.clear
    when /\d{1,3}(-\d{1,3})?(-\d{1,3})?/
      # Generate tree.
      TreeGenerator.generate(input_str)
    else
      # Continue...
    end
    count += 1
  end
end