Class: ToolsConsole

Inherits:
Object show all
Includes:
Singleton
Defined in:
lib/lib/console.rb

Class Method Summary collapse

Class Method Details

.create_console ⇒ Object



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
# File 'lib/lib/console.rb', line 6

def self.create_console

    extend Prompt::DSL

    group "Console commands"

    desc "configure"
    param :config_type , "Config type search for roots locations...", %(location show)
    command "config :config_type" do |config_type|

      Prompt.application.prompt = "#{Tools.configuration.console_prompt} console > ".light_blue
      puts "Choise yuor config action .:".yellow

    end

    desc "history"
    command "history" do
      File.open(@history_file, 'r') do |f|
        while line = f.gets
          puts line
        end
      end
    end

    desc "test"
    command "test" do
      puts 'Im a test.!'.yellow
    end

end

.my_method_missing ⇒ Object



37
38
39
# File 'lib/lib/console.rb', line 37

def self.my_method_missing
  ap "my_method_missing"
end

.run_console ⇒ Object



41
42
43
44
45
# File 'lib/lib/console.rb', line 41

def self.run_console
    Prompt.application.prompt = "#{Tools.configuration.console_prompt} console > ".light_green
    @history_file = File.join(File.expand_path(File.dirname(__FILE__)).to_s, ".workin-history")
    Prompt::Console.start @history_file
end