Module: Byebug::ShowFunctions

Defined in:
lib/byebug/commands/show.rb

Overview

Mix-in module to showing settings

Instance Method Summary collapse

Instance Method Details

#show_setting(setting_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/byebug/commands/show.rb', line 6

def show_setting(setting_name)
  case setting_name
  when /^args$/
    if Command.settings[:argv] and Command.settings[:argv].size > 0
      if defined?(Byebug::BYEBUG_SCRIPT)
        # byebug was called initially. 1st arg is script name.
        args = Command.settings[:argv][1..-1].join(' ')
      else
        # byebug wasn't called initially. 1st arg is not script name.
        args = Command.settings[:argv].join(' ')
      end
    else
      args = ''
    end
    "Argument list to give program being debugged when it is started is \"#{args}\"."
  when /^autolist$/
    "autolist is #{show_onoff(Command.settings[:autolist] > 0)}."
  when /^autoirb$/
    "autoirb is #{show_onoff(Command.settings[:autoirb] > 0)}."
  when /^autosave$/
    "Saving history is #{show_onoff(Command.settings[:autosave])}."
  when /^callstyle$/
    "Frame call-display style is #{Command.settings[:callstyle]}."
  when /^commands(:?\s+(\d+))?$/
    if Command.settings[:autosave]
      history = Byebug::History
      args = @match[1].split
      if args[1]
        size = get_int(args[1], 'show commands', 1, history.max_size)
      end
      size ? history.to_s(size) : history.to_s
    else
      'Not currently saving history. Enable it with "set autosave"'
    end
  when /^testing$/
    "Currently testing byebug is #{show_onoff(Command.settings[:testing])}."
  when /^forcestep$/
    "force-stepping is #{show_onoff(Command.settings[:forcestep])}."
  when /^fullpath$/
    "Displaying frame's full file names is #{show_onoff(Command.settings[:fullpath])}."
  when /^histfile$/
    "The command history file is \"#{Byebug::History.file}\""
  when /^histsize$/
    "Byebug history's maximum size is #{Byebug::History.max_size}"
  when /^linetrace$/
    "line tracing is #{show_onoff(Byebug.tracing?)}."
  when /^linetrace_plus$/
    if Command.settings[:linetrace_plus]
      'line tracing style is every line.'
    else
      'line tracing style is different consecutive lines.'
    end
  when /^listsize$/
    "Number of source lines to list is #{Command.settings[:listsize]}."
  when /^post_mortem$/
    "Post-mortem mode is #{show_onoff(Byebug.post_mortem?)}"
  when /^stack_on_error$/
    "Displaying stack trace is #{show_onoff(Command.settings[:stack_on_error])}."
  when /^verbose$/
    "Verbose output of TracePoint API events is #{show_onoff(Byebug.verbose)}."
  when /^version$/
    "Byebug #{Byebug::VERSION}"
  when /^width$/
    "Width is #{Command.settings[:width]}."
  when /^autoeval|autoreload|basename$/x
    "#{setting_name} is #{show_onoff(Command.settings[setting_name.to_sym])}."
  else
    "Unknown show subcommand #{setting_name}."
  end
end