Class: CircuitPatchTools::Commands::Join

Inherits:
Object
  • Object
show all
Defined in:
lib/circuit_patch_tools/commands/join.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  output: 'patches.sysex'
}

Instance Method Summary collapse

Instance Method Details

#descriptionObject



15
16
17
# File 'lib/circuit_patch_tools/commands/join.rb', line 15

def description
  'join up to 64 patches into a single sysex file'
end

#nameObject



11
12
13
# File 'lib/circuit_patch_tools/commands/join.rb', line 11

def name
  'join'
end

#run(args) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/circuit_patch_tools/commands/join.rb', line 19

def run(args)
  options = DEFAULT_OPTIONS.dup

  OptionParser.new do |opts|
    opts.banner = <<~END
      #{name}: #{description}

      Usage: circuit-patch #{name} [options] patch1.sysex [patch2.sysex ...]

      Options:
    END
    opts.on('-oFILENAME', '--output=FILENAME',
            'Output filename',
            "Default: #{DEFAULT_OPTIONS[:output]}",
            String) do |v|
      options[:output] = v
    end
    opts.on('-h', '--help', 'Print this help') do
      puts opts
      return
    end
  end.parse!(args)

  join options, args
end