Class: GLI::DefaultHelpCommand

Inherits:
Command show all
Defined in:
lib/support/help.rb

Instance Attribute Summary

Attributes inherited from CommandLineToken

#aliases, #description, #long_description, #name

Instance Method Summary collapse

Methods inherited from Command

#action, #arg_name, #arguments_description, #clear_nexts, #default_value, #desc, #flag, #flags, name_as_string, #names, #switch, #switches, #usage

Methods inherited from CommandLineToken

#<=>, #usage

Constructor Details

#initialize(*omit_from_list) ⇒ DefaultHelpCommand

Returns a new instance of DefaultHelpCommand.



6
7
8
9
# File 'lib/support/help.rb', line 6

def initialize(*omit_from_list)
  @omit_from_list = omit_from_list
  super(:help,'Shows list of commands or help for one command','[command]')
end

Instance Method Details

#execute(global_options, options, arguments) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/support/help.rb', line 11

def execute(global_options,options,arguments)
  if arguments.empty?
    list_global_flags
    list_commands
  else
    list_one_command_help(arguments[0])
  end
end