Class: CircuitPatchTools::Commands::Split
- Inherits:
-
Object
- Object
- CircuitPatchTools::Commands::Split
- Defined in:
- lib/circuit_patch_tools/commands/split.rb
Constant Summary collapse
- FIELDS =
i[ name command location genre category polyphony ]
- DEFAULT_OPTIONS =
{ filename: '%<location>02d - %<name>s.sysex' }
- PATCH_REGEXP =
/\xF0\x00\x20\x29\x01\x60[\x00-\xFF]{343}\xF7/n
Instance Method Summary collapse
Instance Method Details
#description ⇒ Object
19 20 21 |
# File 'lib/circuit_patch_tools/commands/split.rb', line 19 def description 'extract patches from a single sysex file into one file per patch' end |
#name ⇒ Object
15 16 17 |
# File 'lib/circuit_patch_tools/commands/split.rb', line 15 def name 'split' end |
#run(args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/circuit_patch_tools/commands/split.rb', line 23 def run(args) = DEFAULT_OPTIONS.dup OptionParser.new do |opts| opts. = " \#{name}: \#{description}\n\n Usage: circuit-patch \#{name} [options] patch1.sysex [patch2.sysex ...]\n\n Options:\n END\n opts.on('-fPATTERN', '--filename=PATTERN',\n 'Pattern for filenames',\n \"Default: \#{DEFAULT_OPTIONS[:filename].inspect}\",\n String) do |v|\n options[:filename] = v\n end\n opts.on('-h', '--help', 'Print this help') do\n puts opts\n return\n end\n end.parse!(args)\n\n extract_all options, args\nend\n" |