Module: UniMIDI::Command

Defined in:
lib/unimidi/command.rb

Overview

Module for command-line use of UniMIDI. Used by the bin/unimidi script

Class Method Summary collapse

Class Method Details

.exec(command, _options = {}) ⇒ Boolean

Execute a command

Parameters:

  • command (Symbol)
  • options (Hash)

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/unimidi/command.rb', line 12

def exec(command, _options = {})
  if %i[l list list_devices].include?(command)
    puts 'input:'
    Input.list
    puts 'output:'
    Output.list
    true
  else
    raise "Command #{command} not found"
  end
end