Sha256: f4352768d4a6e2d6178a91451868c1b8eb14df118963c886015462c29615b61a

Contents?: true

Size: 916 Bytes

Versions: 64

Compression:

Stored size: 916 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

      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

64 entries across 64 versions & 3 rubygems

Version Path
avm-tools-0.68.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.44.0 lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.67.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.66.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.65.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.64.2 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.64.1 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.64.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.63.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.62.4 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.62.3 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.62.2 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.62.1 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.62.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.61.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.60.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.59.0 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.43.0 lib/eac_ruby_utils/console/docopt_runner.rb
avm-tools-0.58.1 vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.42.0 lib/eac_ruby_utils/console/docopt_runner.rb