Class: Topicz::Commands::HelpCommand
- Inherits:
-
Object
- Object
- Topicz::Commands::HelpCommand
- Defined in:
- lib/topicz/commands/help_command.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(config_file = nil, arguments = []) ⇒ HelpCommand
constructor
A new instance of HelpCommand.
- #option_parser ⇒ Object
Constructor Details
#initialize(config_file = nil, arguments = []) ⇒ HelpCommand
Returns a new instance of HelpCommand.
7 8 9 10 11 12 13 14 15 |
# File 'lib/topicz/commands/help_command.rb', line 7 def initialize(config_file = nil, arguments = []) option_parser.order! arguments @help = if arguments == nil || arguments.empty? self else Topicz::CommandFactory.new.load_command(arguments.shift).new end.option_parser end |
Instance Method Details
#execute ⇒ Object
27 28 29 |
# File 'lib/topicz/commands/help_command.rb', line 27 def execute puts @help.help end |
#option_parser ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/topicz/commands/help_command.rb', line 17 def option_parser OptionParser.new do || . = 'Usage: help <command>' .separator '' .separator 'Shows help about a specific command. Valid commands are:' .separator '' .separator Topicz::COMMANDS.to_s end end |