Sha256: b5d0be5dd02318f006a44599d5e4181e202c02e230adda8c89dff5cfc8d45224

Contents?: true

Size: 749 Bytes

Versions: 6

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'docopt'

module EacCli
  class DocoptRunner
    require_sub __FILE__
    extend ::EacCli::DocoptRunner::ClassMethods
    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.4 lib/eac_cli/docopt_runner.rb
eac_cli-0.20.3 lib/eac_cli/docopt_runner.rb
avm-tools-0.102.2 vendor/eac_cli/lib/eac_cli/docopt_runner.rb
eac_cli-0.20.2 lib/eac_cli/docopt_runner.rb
avm-tools-0.102.1 vendor/eac_cli/lib/eac_cli/docopt_runner.rb
eac_cli-0.20.1 lib/eac_cli/docopt_runner.rb