Sha256: de898c61fdf26dad004dbba7130d8c908ed56106d7e784178da6df4a290dc86e

Contents?: true

Size: 669 Bytes

Versions: 5

Compression:

Stored size: 669 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
        ::EacCli::Docopt::DocBuilder.new(self.class.runner_definition).to_s
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
avm-tools-0.82.1 vendor/eac_cli/lib/eac_cli/runner_with/help.rb
avm-tools-0.82.0 vendor/eac_cli/lib/eac_cli/runner_with/help.rb
avm-tools-0.81.0 vendor/eac_cli/lib/eac_cli/runner_with/help.rb
eac_cli-0.12.3 lib/eac_cli/runner_with/help.rb
ehbrs-tools-0.16.3 vendor/eac_cli/lib/eac_cli/runner_with/help.rb