module Byebug::EnableDisableFunctions
def enable_disable_breakpoints(is_enable, args)
def enable_disable_breakpoints(is_enable, args) return errmsg "No breakpoints have been set." if Byebug.breakpoints.empty? all_breakpoints = Byebug.breakpoints.sort_by {|b| b.id } if !args selected_breakpoints = all_breakpoints else selected_ids = [] args.each do |pos| pos = get_int(pos, "#{is_enable} breakpoints", 1, all_breakpoints.last.id) return nil unless pos selected_ids << pos end selected_breakpoints = all_breakpoints.select { |b| selected_ids.include?(b.id) } end selected_breakpoints.each do |b| enabled = ('enable' == is_enable) if enabled && !syntax_valid?(b.expr) errmsg "Expression \"#{b.expr}\" syntactically incorrect; " \ "breakpoint remains disabled.\n" else b.enabled = enabled end end end