Sha256: 734619459bd923563e2164cc2dd46250079fae66b264016a4d9d6c1e477107b5

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

module Wukong
  class Runner

    # Defines methods for handling help messages.
    #
    # Runners which want to modify how help messages are generated
    # should override the `contextualize_help_message!` instance method.
    module HelpMessage

      # Was the `--help` option specified on the command line?
      #
      # The boot sequence for a Runner strips out the `--help` option to
      # allow individual Runner classes to customize their help
      # messages.
      #
      # @return [true, false]
      def help_given?
        !!@help_given
      end

      # Strip the `--help` message from the original ARGV, storing
      # whether or not it was given for later.
      def strip_help_param!
        @help_given = ARGV.delete('--help')
      end

      # Print a help message.
      def dump_help
        settings.dump_help
      end

      # Print a help message and exit.
      #
      # @raise [SystemExit]
      def dump_help_and_exit!
        dump_help
        exit(1)
      end
        
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
ul-wukong-4.1.1 lib/wukong/runner/help_message.rb
ul-wukong-4.1.0 lib/wukong/runner/help_message.rb
wukong-4.0.0 lib/wukong/runner/help_message.rb
wukong-3.0.1 lib/wukong/runner/help_message.rb
wukong-3.0.0 lib/wukong/runner/help_message.rb