Sha256: 0ded87bc321f642205d19dcccb3dbff8e6dde1ef203ff1b3f63e36c10d574795
Contents?: true
Size: 1.37 KB
Versions: 29
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true require 'eac_cli/docopt/doc_builder' require 'eac_cli/docopt/runner_context_replacement' require 'eac_cli/runner' require 'eac_ruby_utils/console/docopt_runner' module EacCli module Docopt module RunnerExtension extend ::ActiveSupport::Concern included do prepend InstanceMethods end class << self def check(klass) return unless klass < ::EacRubyUtils::Console::DocoptRunner ::EacCli::Runner.alias_runner_class_methods(klass, '', 'eac_cli') ::EacCli::Runner.alias_runner_class_methods(klass, 'original', '') klass.include(self) end end module InstanceMethods def doc ::EacCli::Docopt::DocBuilder.new(self.class.runner_definition).to_s end def docopt_options super.merge(options_first: self.class.runner_definition.options_first?) end def runner_context @runner_context ||= ::EacCli::Docopt::RunnerContextReplacement.new(self) end end def extra_available_subcommands self.class.constants .map { |name| self.class.const_get(name) } .select { |c| c.instance_of? Class } .select { |c| c.included_modules.include?(::EacCli::Runner) } .map { |c| c.name.demodulize.underscore.dasherize } end end end end
Version data entries
29 entries across 29 versions & 3 rubygems