Class: ToolsConsole

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ToolsConsole

Returns a new instance of ToolsConsole.



14
# File 'lib/lib/console.rb', line 14

def initialize(options = {}); end

Class Method Details

.create_consoleObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lib/console.rb', line 16

def self.create_console
  extend Prompt::DSL

  group 'Console commands'

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

.exec_console(args) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/lib/console.rb', line 5

def self.exec_console(args)
  command_name = args.extract_first
  cmd = Prompt.application.commands.select { |c| c.name.eql? command_name }.first
  return false if cmd.nil?

  cmd.run cmd
  true
end

.run_consoleObject



28
29
30
31
32
# File 'lib/lib/console.rb', line 28

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