lib/byebug/commands/set.rb in byebug-0.0.1 vs lib/byebug/commands/set.rb in byebug-1.0.0
- old
+ new
@@ -1,40 +1,42 @@
module Byebug
+
# Implements byebug "set" command.
class SetCommand < Command
SubcmdStruct2=Struct.new(:name, :min, :is_bool, :short_help,
:long_help) unless defined?(SubcmdStruct2)
Subcommands =
[
['annotate', 2, false, "Set annotation level",
-"0 == normal
-2 == output annotated suitably for use by programs that control byebug."],
+ '0 == normal. ' \
+ '2 == output annotated suitably for use by programs that control ' \
+ 'byebug.'],
['args', 2, false,
- "Set argument list to give program being debugged when it is started",
-"Follow this command with any number of args, to be passed to the program."],
+ 'Set argument list to give program being debugged when it is started'],
['autoeval', 4, true, "Evaluate every unrecognized command"],
['autolist', 4, true, "Execute 'list' command on every breakpoint"],
['autoirb', 4, true, "Invoke IRB on every stop"],
['autoreload', 4, true, "Reload source code when changed"],
['basename', 1, true, "Report file basename only showing file names"],
['callstyle', 2, false, "Set how you want call parameters displayed"],
- ['byebugtesting', 8, false, "Used when testing the byebug"],
+ ['byebugtesting', 8, false, "Used when testing byebug"],
['forcestep', 2, true,
-"Make sure 'next/step' commands always move to a new line"],
+ 'Make sure \'next/step\' commands always move to a new line'],
['fullpath', 2, true, "Display full file names in frames"],
['history', 2, false,
-"Generic command for setting command history parameters",
-"set history filename -- Set the filename in which to record the command history
-set history save -- Set saving of the history record on exit
-set history size -- Set the size of the command history"],
+ 'Generic command for setting command history parameters',
+ 'set history filename -- Set the filename in which to record the ' \
+ 'command history. ' \
+ 'set history save -- Set saving of the history record on exit. ' \
+ 'set history size -- Set the size of the command history'],
['linetrace+', 10, true,
-"Set line execution tracing to show different lines"],
+ 'Set line execution tracing to show different lines'],
['linetrace', 3, true, "Set line execution tracing"],
['listsize', 3, false, "Set number of source lines to list by default"],
['trace', 1, true, "Display stack trace when 'eval' raises exception"],
['width', 1, false,
-"Number of characters the byebug thinks are in a line"]
+ 'Number of characters per line for byebug\'s output']
].map do |name, min, is_bool, short_help, long_help|
SubcmdStruct2.new(name, min, is_bool, short_help, long_help)
end unless defined?(Subcommands)
self.allow_in_control = true
@@ -94,18 +96,17 @@
Command.settings[:basename] = set_on
when /^callstyle$/
if args[0]
arg = args[0].downcase.to_sym
case arg
- when :short, :last
+ when :short, :last, :tracked
Command.settings[:callstyle] = arg
- print "%s\n" % show_setting(try_subcmd.name)
- return
+ else
+ print "Invalid call style #{arg}. Should be one of: " \
+ "'short', 'last' or 'tracked'.\n"
end
end
- print "Invalid call style #{arg}. Should be one of: " +
- "'short' or 'last'.\n"
when /^trace$/
Command.settings[:stack_trace_on_error] = set_on
when /^fullpath$/
Command.settings[:full_path] = set_on
when /^autoreload$/
@@ -124,19 +125,22 @@
interface = @state.interface
case args[0]
when /^save$/
interface.history_save = get_onoff(args[1])
when /^size$/
- interface.history_length = get_int(args[1],
- "Set history size")
+ interface.history_length =
+ get_int(args[1], "Set history size")
when /^filename$/
- interface.histfile = File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", args[1])
+ interface.histfile =
+ File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", args[1])
else
- print "Invalid history parameter #{args[0]}. Should be 'filename', 'save' or 'size'.\n"
+ print "Invalid history parameter #{args[0]}. Should be " \
+ "'filename', 'save' or 'size'.\n"
end
else
- print "Need two parameters for 'set history'; got #{args.size}.\n"
+ print "Need two parameters for 'set history'; got " \
+ "#{args.size}.\n"
return
end
when /^linetrace\+$/
self.class.settings[:tracing_plus] = set_on
when /^linetrace$/
@@ -158,10 +162,10 @@
end
else
print "Unknown setting #{@match[1]}.\n"
return
end
- print "%s\n" % show_setting(try_subcmd.name)
+ print "#{show_setting(try_subcmd.name)}\n"
return
rescue RuntimeError
return
end
end