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



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

def self.description
  <<-EOD
    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>
  EOD
end

.regexpObject



12
13
14
# File 'lib/byebug/commands/help.rb', line 12

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

.short_descriptionObject



28
29
30
# File 'lib/byebug/commands/help.rb', line 28

def self.short_description
  'Helps you using byebug'
end

Instance Method Details

#executeObject



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

def execute
  return help_for_all unless @match[1]

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

  help_for(@match[2], subcommand)
end