Class: CircuitPatchTools::Commands::Info

Inherits:
Object
  • Object
show all
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

#descriptionObject



17
18
19
# File 'lib/circuit_patch_tools/commands/info.rb', line 17

def description
  'show patch information'
end

#nameObject



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)
  options = DEFAULT_OPTIONS.dup

  OptionParser.new do |opts|
    opts.banner = "      \#{name}: \#{description}\n\n      Usage: circuit-patch \#{name} [options] patch1.sysex [patch2.sysex ...]\n\n      Options:\n    END\n    opts.on('-fFIELDS', '--fields=FIELDS',\n            'Comma-separated list of fields to show',\n            \"Default: \#{DEFAULT_OPTIONS.fetch(:fields).join(',')}\",\n            Array) do |v|\n      options[:fields] = v\n    end\n    opts.on('-l', '--list', 'List available fields') do\n      puts *FIELDS\n    end\n    opts.on('-h', '--help', 'Print this help') do\n      puts opts\n      return\n    end\n  end.parse!(args)\n\n  args.each do |path|\n    show_info options, path\n  end\nend\n"