Sha256: 1968cdc614319785a062aea2e9d66182fafec59d4fbcc0827809b8794c7661fe

Contents?: true

Size: 701 Bytes

Versions: 6

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'docopt'

module EacCli
  class DocoptRunner
    require_sub __FILE__
    include ::EacCli::DocoptRunner::Context

    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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
eac_cli-0.20.0 lib/eac_cli/docopt_runner.rb
avm-tools-0.102.0 vendor/eac_cli/lib/eac_cli/docopt_runner.rb
eac_cli-0.19.0 lib/eac_cli/docopt_runner.rb
avm-tools-0.101.0 vendor/eac_cli/lib/eac_cli/docopt_runner.rb
eac_cli-0.18.0 lib/eac_cli/docopt_runner.rb
avm-tools-0.100.0 vendor/eac_cli/lib/eac_cli/docopt_runner.rb