Class: Clin::HelpOptions

Inherits:
GeneralOption show all
Defined in:
lib/clin/common/help_options.rb

Overview

Help option class Add the help option to you command “‘ class MyCommand < Clin::Command

general_option Clin::HelpOptions

end “‘ Then running you command with -h or –help will show the help menu

Instance Method Summary collapse

Constructor Details

#initialize(raise: true) ⇒ HelpOptions

Returns a new instance of HelpOptions.



17
18
19
# File 'lib/clin/common/help_options.rb', line 17

def initialize(raise: true)
  @raise = raise
end

Instance Method Details

#execute(options) ⇒ Object



21
22
23
24
# File 'lib/clin/common/help_options.rb', line 21

def execute(options)
  return unless @raise
  fail Clin::HelpError, options[:help] if options[:help]
end