module Byebug::ParseFunctions

def get_onoff(arg, default=nil, print_error=true)

Any other value raises RuntimeError.
Return true if arg is 'on' or 1 and false arg is 'off' or 0.
def get_onoff(arg, default=nil, print_error=true)
  if arg.nil? or arg == ''
    if default.nil?
      if print_error
        print "Expecting 'on', 1, 'off', or 0. Got nothing.\n"
        raise RuntimeError
      end
      return default
    end
  end
  case arg.downcase
  when '1', 'on'
    return true
  when '0', 'off'
    return false
  else
    if print_error
      print "Expecting 'on', 1, 'off', or 0. Got: #{arg.to_s}.\n"
      raise RuntimeError
    end
  end
end