Class: Terminitor::CmdCore
- Inherits:
-
AbstractCore
- Object
- AbstractCore
- Terminitor::CmdCore
- Defined in:
- lib/terminitor/cores/cmd_core/cmd_core.rb
Constant Summary collapse
- CMD_XLT =
{ 'clear' => 'cls' }
Instance Attribute Summary collapse
-
#current_window ⇒ Object
readonly
Returns the value of attribute current_window.
Attributes inherited from AbstractCore
#termfile, #terminal, #windows, #working_dir
Instance Method Summary collapse
- #create_window(options = {}) ⇒ Object
- #execute_command(cmd, options = {}) ⇒ Object
-
#initialize(path) ⇒ CmdCore
constructor
A new instance of CmdCore.
- #open_tab(options = {}) ⇒ Object
- #open_window(options = {}) ⇒ Object
Methods inherited from AbstractCore
#active_window, #load_termfile, #process!, #run_in_window, #set_delayed_options, #setup!
Constructor Details
#initialize(path) ⇒ CmdCore
Returns a new instance of CmdCore.
9 10 11 12 |
# File 'lib/terminitor/cores/cmd_core/cmd_core.rb', line 9 def initialize(path) @current_window = CurrentWindowsConsole.new super end |
Instance Attribute Details
#current_window ⇒ Object (readonly)
Returns the value of attribute current_window.
3 4 5 |
# File 'lib/terminitor/cores/cmd_core/cmd_core.rb', line 3 def current_window @current_window end |
Instance Method Details
#create_window(options = {}) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/terminitor/cores/cmd_core/cmd_core.rb', line 28 def create_window( = {}) c = WindowsConsole.new :name=>'cmd' c.send_command "title #{[:name]}\n" if [:name] c.send_command "mode con: cols=#{[:bounds][0]} lines=#{[:bounds][1]}\n" if [:bounds] c end |
#execute_command(cmd, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/terminitor/cores/cmd_core/cmd_core.rb', line 14 def execute_command(cmd, = {}) cmd = CMD_XLT[cmd] || cmd cmd += "\n" if (cmd =~ /\n\Z/).nil? ([:in] || current_window).send_command(cmd) end |
#open_tab(options = {}) ⇒ Object
20 21 22 |
# File 'lib/terminitor/cores/cmd_core/cmd_core.rb', line 20 def open_tab( = {}) create_window end |
#open_window(options = {}) ⇒ Object
24 25 26 |
# File 'lib/terminitor/cores/cmd_core/cmd_core.rb', line 24 def open_window( = {}) create_window end |