Sha256: 060d2e99a9bf383552e9ac398ec7f31a5b2f03b8375deb4dd04b9c8bf32379d5

Contents?: true

Size: 938 Bytes

Versions: 105

Compression:

Stored size: 938 Bytes

Contents

# frozen_string_literal: true

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

module EacCli
  module RunnerWith
    module Help
      require_sub __FILE__, require_dependency: true
      common_concern do
        include ::EacCli::Runner

        runner_definition.alt do
          bool_opt '-h', '--help', 'Show help.', usage: true, required: true
          pos_arg :any_arg_with_help, repeat: true, optional: true, visible: false
        end

        set_callback :run, :before do
          help_run
        end
      end

      def help_run
        return unless show_help?

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

      def help_text
        r = ::EacCli::RunnerWith::Help::Builder.new(self).to_s
        r += help_extra_text if respond_to?(:help_extra_text)
        r
      end

      def show_help?
        parsed.help? && !if_respond(:run_subcommand?, false)
      end
    end
  end
end

Version data entries

105 entries across 105 versions & 3 rubygems

Version Path
eac_tools-0.62.1 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_cli-0.31.0 lib/eac_cli/runner_with/help.rb
eac_tools-0.62.0 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.61.1 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.61.0 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.60.3 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.60.2 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.60.1 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.60.0 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.59.0 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.58.0 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.57.0 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.56.1 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.56.0 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.55.7 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.55.6 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.55.5 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.55.4 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.55.3 sub/eac_cli/lib/eac_cli/runner_with/help.rb
eac_tools-0.55.2 sub/eac_cli/lib/eac_cli/runner_with/help.rb