Sha256: f3ef23c32135d7c9cb33a714c2862a203f3f8c6a5059b921e11f38c720b79cb1

Contents?: true

Size: 1017 Bytes

Versions: 87

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/hash/slice'
require 'docopt'
require 'eac_ruby_utils/contextualizable'
require 'eac_ruby_utils/patches/hash/sym_keys_hash'
Dir["#{__dir__}/#{::File.basename(__FILE__, '.*')}/_*.rb"].sort.each do |partial|
  require partial
end

module EacRubyUtils
  module Console
    class DocoptRunner
      include ::EacRubyUtils::Contextualizable

      class << self
        def create(settings = {})
          new(settings)
        end
      end

      attr_reader :settings

      def initialize(settings = {})
        @settings = settings.with_indifferent_access.freeze
        check_subcommands
      end

      def options
        @options ||= Docopt.docopt(target_doc, docopt_options)
      end

      def parent
        settings[:parent]
      end

      protected

      def docopt_options
        settings.slice(:version, :argv, :help, :options_first).to_sym_keys_hash
      end
    end
  end
end

Version data entries

87 entries across 87 versions & 3 rubygems

Version Path
avm-tools-0.98.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.97.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.96.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.63.0 lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.95.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.62.1 lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.94.3 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.62.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.61.0 lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.94.2 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.60.0 lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.94.1 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.59.0 lib/eac_ruby_utils/console/docopt_runner.rb
ehbrs-tools-0.20.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.94.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.93.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.92.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.91.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.90.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.89.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb