module Byebug::SetFunctions
def set_setting(setting_name, setting_value, setting_args)
def set_setting(setting_name, setting_value, setting_args) case setting_name when /^args$/ if defined?(Byebug::BYEBUG_SCRIPT) Command.settings[:argv][1..-1] = setting_args else Command.settings[:argv] = setting_args end when /^autoirb$/ Command.settings[:autoirb] = (setting_value ? 1 : 0) when /^autolist$/ Command.settings[:autolist] = (setting_value ? 1 : 0) when /^callstyle$/ if setting_args[0] and ['short', 'long'].include?(setting_args[0]) Command.settings[:callstyle] = setting_args[0].to_sym else print "Invalid callstyle. Should be one of: \"short\" or \"long\"\n" end when /^verbose$/ Byebug.verbose = setting_value when /^history$/ try_subcmd = setting_args[0] subcmd = Command.find(SetCommand::SetHistorySubcommands, try_subcmd) return print "Invalid history parameter #{try_subcmd}. Should be" \ ' "filename", "save" or "size"' unless subcmd sub_sub_cmd = setting_args[1] iface = @state.interface case subcmd.name when /^save$/ iface.history_save = sub_sub_cmd ? get_onoff(sub_sub_cmd) : true when /^size$/ return print 'You need to specify the history size' unless sub_sub_cmd iface.history_length = get_int(sub_sub_cmd, "Set history size") when /^filename$/ return print 'You need to specify a filename' unless sub_sub_cmd iface.histfile = File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", sub_sub_cmd) end when /^linetrace$/ Byebug.tracing = setting_value when /^listsize$/ listsize = get_int(setting_args[0], "Set listsize", 1, nil, 10) return unless listsize Command.settings[:listsize] = listsize when /^width$/ return unless width = get_int(setting_args[0], "Set width", 10, nil, 80) Command.settings[:width] = width when /^post_mortem$/ Byebug.post_mortem = setting_value when /^autoeval|autoreload|basename|forcestep|fullpath|linetrace_plus| testing|stack_on_error$/x Command.settings[setting_name.to_sym] = setting_value else return print "Unknown setting #{@match[1]}.\n" end end