class Byebug::EnableDisableCommand


Enabling or disabling custom display expressions or breakpoints.

def description

def description
  prettify <<-EOD
    (en|dis)[able][[ (breakpoints|display)][ n1[ n2[ ...[ nn]]]]]
     Enables or disables breakpoints or displays.
     "enable" by itself enables all breakpoints, just like
     "enable breakpoints". On the other side, "disable" or
     "disable breakpoints" disable all breakpoints.
     You can also specify a space separated list of breakpoint numbers to
     enable or disable specific breakpoints. You can use either
     "enable <id1> ... <idn>" or "enable breakpoints <id1> ... <idn>" and
     the same with "disable".
     If instead of "breakpoints" you specify "display", the command will
     work exactly the same way, but displays will get enabled/disabled
     instead of breakpoints.
   EOD
end

def disable_breakpoints(args)

def disable_breakpoints(args)
  enable_disable_breakpoints('disable', args)
end

def disable_display(args)

def disable_display(args)
  enable_disable_display('disable', args)
end

def enable_breakpoints(args)

def enable_breakpoints(args)
  enable_disable_breakpoints('enable', args)
end

def enable_display(args)

def enable_display(args)
  enable_disable_display('enable', args)
end

def execute

def execute
  cmd = @match[1] == 'dis' ? 'disable' : 'enable'
  return errmsg(pr('toggle.errors.syntax', toggle: cmd)) unless @match[2]
  args = @match[2].split(/[ \t]+/)
  param = args.shift
  subcmd = Command.find(Subcommands, param)
  if subcmd
    send("#{cmd}_#{subcmd.name}", args)
  else
    send("#{cmd}_breakpoints", args.unshift(param))
  end
end

def names

def names
  %w((en|dis)able)
end

def regexp

def regexp
  /^\s* (dis|en)(?:able)? (?:\s+(.+))? \s*$/x
end