Class: Termtter::CommandLine

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/plugins/defaults/command_line.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



9
10
11
# File 'lib/plugins/defaults/command_line.rb', line 9

def start
  instance.start
end

.stopObject



13
14
15
# File 'lib/plugins/defaults/command_line.rb', line 13

def stop
  instance.stop
end

Instance Method Details

#call(command_text) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/plugins/defaults/command_line.rb', line 26

def call(command_text)
  # Example:
  # t.register_hook(:post_all, :point => :prepare_command) do |s|
  #   "update #{s}"
  # end
  Client.get_hooks('prepare_command').each {|hook|
    command_text = hook.call(command_text)
  }
  Client.call_commands(command_text)
end

#promptObject



37
38
39
40
41
42
43
# File 'lib/plugins/defaults/command_line.rb', line 37

def prompt
  prompt_text = config.prompt
  Client.get_hooks('prepare_prompt').each {|hook|
    prompt_text = hook.call(prompt_text)
  }
  prompt_text
end

#startObject



18
19
20
# File 'lib/plugins/defaults/command_line.rb', line 18

def start
  start_input_thread
end

#stopObject



22
23
24
# File 'lib/plugins/defaults/command_line.rb', line 22

def stop
  @input_thread.kill
end