Class: Wocker::Cli::KeyboardCommand::KeyCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/wocker/cli/keyboard/key_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/wocker/cli/keyboard/key_command.rb', line 9

def execute
  first_vm_name = Wocker::Virtualbox.first_running_vm_name

  scancodes = case key_list
  when ["control","alt","del"]
    "1d 38 53 d3 b8 9d"
  when ["enter"]
    "1c 9c"
  when ["control","c"]
    "1d 2e ae 9d"
  else
    puts "unknown: #{key_list.inspect}"
    exit 1
  end

  `VBoxManage controlvm #{first_vm_name} keyboardputscancode #{scancodes}`
end