Class: CircuitPatchTools::Commands::Info
- Inherits:
-
Object
- Object
- CircuitPatchTools::Commands::Info
- Defined in:
- lib/circuit_patch_tools/commands/info.rb
Defined Under Namespace
Classes: Patch
Constant Summary collapse
- FIELDS =
%i[ path name command location genre category polyphony ]
- DEFAULT_OPTIONS =
{ fields: %w[ name genre category command location polyphony ] }
Instance Method Summary collapse
Instance Method Details
#description ⇒ Object
17 18 19 |
# File 'lib/circuit_patch_tools/commands/info.rb', line 17 def description 'show patch information' end |
#name ⇒ Object
13 14 15 |
# File 'lib/circuit_patch_tools/commands/info.rb', line 13 def name 'info' end |
#run(args) ⇒ Object
21 22 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 48 49 50 |
# File 'lib/circuit_patch_tools/commands/info.rb', line 21 def run(args) = DEFAULT_OPTIONS.dup OptionParser.new do |opts| opts. = <<~END #{name}: #{description} Usage: circuit-patch #{name} [options] patch1.sysex [patch2.sysex ...] Options: END opts.on('-fFIELDS', '--fields=FIELDS', 'Comma-separated list of fields to show', "Default: #{DEFAULT_OPTIONS.fetch(:fields).join(',')}", Array) do |v| [:fields] = v end opts.on('-l', '--list', 'List available fields') do puts *FIELDS end opts.on('-h', '--help', 'Print this help') do puts opts return end end.parse!(args) args.each do |path| show_info , path end end |