Sha256: e01fab0a644210e2cfe2a1073a3cdd95a8abe4de6b5d9bf040765d80b6c9a368

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

module Coltrane
  module Commands
    class Command
      COMMON_OPTIONS = {
        on: [
          '--on <INSTRUMENT>',
          'Shows the notes on the given instrument/representation type. ' \
          'Can be piano, guitar, ukulele, bass or text'
        ],

        flavor: [
          '--flavor <FLAVOR>',
          'Chooses which additional information to display: ' \
          'marks, notes, intervals or degrees'
        ],

        voicings: [
          '--voicings <NUMBER>',
          'Number of voicings for guitar like instruments. Default is 6' \
          'provided they are separated by dashes'
        ]
      }

      def render
        puts "\n" + Renderers::TextRenderer.render(
          representation, **renderer_options
        )
      end

      def renderer_options
        {}
      end

      class << self

        def subclasses
          @subclasses ||= []
        end

        def inherited(base)
          subclasses << base
          super(base)
        end

        def add_shared_option(option_name, mercenary_command)
          mercenary_command.option(option_name, *COMMON_OPTIONS[option_name])
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
coltrane-3.1.3 lib/coltrane/commands/command.rb
coltrane-3.1.2 lib/coltrane/commands/command.rb
coltrane-3.1.1 lib/coltrane/commands/command.rb
coltrane-3.1.0 lib/coltrane/commands/command.rb
coltrane-3.0.0 lib/coltrane/commands/command.rb