Sha256: 31aa7923ceb846f9db2f937f64b54c50c7846d7dead0e9971c20b251e17c1ea4

Contents?: true

Size: 911 Bytes

Versions: 17

Compression:

Stored size: 911 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"].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

17 entries across 17 versions & 1 rubygems

Version Path
eac_ruby_utils-0.21.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.20.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.19.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.18.1 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.18.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.17.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.16.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.15.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.14.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.13.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.12.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.11.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.10.1 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.10.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.9.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.8.0 lib/eac_ruby_utils/console/docopt_runner.rb
eac_ruby_utils-0.7.0 lib/eac_ruby_utils/console/docopt_runner.rb