Sha256: 5a56379741d29dd1e2a90e22eb856770813a1af2e094c519d656773a357fa1d0

Contents?: true

Size: 745 Bytes

Versions: 44

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/runner'
require 'eac_ruby_utils/core_ext'

module EacCli
  module RunnerWith
    module Help
      common_concern do
        include ::EacCli::Runner

        runner_definition.alt do
          options_argument false
          bool_opt '-h', '--help', 'Show help.', usage: true
        end

        set_callback :run, :before do
          help_run
        end
      end

      def help_run
        return unless parsed.help?

        puts help_text
        raise ::EacCli::Runner::Exit
      end

      def help_text
        r = ::EacCli::Docopt::DocBuilder.new(self.class.runner_definition).to_s
        r += help_extra_text if respond_to?(:help_extra_text)
        r
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 3 rubygems

Version Path
avm-tools-0.84.0 vendor/eac_cli/lib/eac_cli/runner_with/help.rb
avm-tools-0.83.0 vendor/eac_cli/lib/eac_cli/runner_with/help.rb
eac_cli-0.12.4 lib/eac_cli/runner_with/help.rb
ehbrs-tools-0.16.4 vendor/eac_cli/lib/eac_cli/runner_with/help.rb