class Byebug::HelpCommand - byebug-4.0.5 Documentation

# class Byebug::HelpCommand

Ask for help from byebug's prompt.

### Public Class Methods

description() click to toggle source

    # 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() click to toggle source

    # File lib/byebug/commands/help.rb, line 24
    def names
      %w(help)
    end

### Public Instance Methods

execute() click to toggle source

    # 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() click to toggle source

    # File lib/byebug/commands/help.rb, line 10
    def regexp
      /^\s* h(?:elp)? (?: \s+(\S+) (?:\s+(\S+))? )? \s*$/x
    end