Class: Byebug::HelpCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/help.rb

Overview

Ask for help from byebug’s prompt.

Instance Attribute Summary

Attributes inherited from Command

#processor

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#arguments, columnize, #context, #frame, help, #initialize, match, to_s

Methods included from Byebug::Helpers::StringHelper

#camelize, #deindent, #prettify

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/byebug/commands/help.rb', line 18

def self.description
  <<-DESCRIPTION
    h[elp][ <cmd>[ <subcmd>]]

    #{short_description}

    help                -- prints a summary of all commands
    help <cmd>          -- prints help on command <cmd>
    help <cmd> <subcmd> -- prints help on <cmd>'s subcommand <subcmd>
  DESCRIPTION
end

.regexpObject



14
15
16
# File 'lib/byebug/commands/help.rb', line 14

def self.regexp
  /^\s* h(?:elp)? (?:\s+(\S+))? (?:\s+(\S+))? \s*$/x
end

.short_descriptionObject



30
31
32
# File 'lib/byebug/commands/help.rb', line 30

def self.short_description
  "Helps you using byebug"
end

Instance Method Details

#executeObject



34
35
36
37
38
39
40
# File 'lib/byebug/commands/help.rb', line 34

def execute
  return help_for_all unless @match[1]

  return help_for(@match[1], command) unless @match[2]

  help_for(@match[2], subcommand)
end