module Byebug::ParseFunctions

def get_int(str, cmd, min = nil, max = nil)


min or max is nil, that value has no bound.
Parse 'str' of command 'cmd' as an integer between min and max. If either
def get_int(str, cmd, min = nil, max = nil)
  if str !~ /\A[0-9]+\z/
    return nil, "\"#{cmd}\" argument \"#{str}\" needs to be a number"
  end
  int = str.to_i
  if min && int < min
    return nil, "\"#{cmd}\" argument \"#{str}\" needs to be at least #{min}"
  elsif max && int > max
    return nil, "\"#{cmd}\" argument \"#{str}\" needs to be at most #{max}"
  end
  int
end