Class: Byebug::HelpCommand
- Defined in:
- lib/byebug/commands/help.rb
Overview
Ask for help from byebug’s prompt.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Command
commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match
Methods included from StringFunctions
Methods included from FileFunctions
#get_line, #get_lines, #n_lines, #normalize
Methods included from ParseFunctions
#get_int, #parse_steps, #syntax_valid?
Constructor Details
This class inherits a constructor from Byebug::Command
Class Method Details
.description ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/byebug/commands/help.rb', line 28 def description prettify <<-EOD h[elp][ <cmd>[ <subcmd>]] help -- prints this help. help <cmd> -- prints help on command <cmd>. help <cmd> <subcmd> -- prints help on <cmd>'s subcommand <subcmd>. EOD end |
.names ⇒ Object
24 25 26 |
# File 'lib/byebug/commands/help.rb', line 24 def names %w(help) end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/byebug/commands/help.rb', line 14 def execute return puts(self.class.help) unless @match[1] cmd = Command.commands.select { |c| c.names.include?(@match[1]) } return errmsg(pr('help.errors.undefined', cmd: @match[1])) unless cmd.any? cmd.each { |c| puts c.help(@match[2]) } end |
#regexp ⇒ Object
10 11 12 |
# File 'lib/byebug/commands/help.rb', line 10 def regexp /^\s* h(?:elp)? (?: \s+(\S+) (?:\s+(\S+))? )? \s*$/x end |