class Byebug::OptionSetter

Handles byebug's command line options

Public Class Methods

new(runner, opts) click to toggle source
# File lib/byebug/option_setter.rb, line 6
def initialize(runner, opts)
  @runner = runner
  @opts = opts
end

Public Instance Methods

setup() click to toggle source
# File lib/byebug/option_setter.rb, line 11
def setup
  debug
  include_flag
  post_mortem
  quit
  rc
  stop
  require_flag
  remote
  trace
  version
  help
end

Private Instance Methods

debug() click to toggle source
# File lib/byebug/option_setter.rb, line 27
def debug
  @opts.on '-d', '--debug', 'Set $DEBUG=true' do
    $DEBUG = true
  end
end
help() click to toggle source
# File lib/byebug/option_setter.rb, line 87
def help
  @opts.on '-h', '--help', 'Display this message' do
    @runner.help = @opts.help
  end
end
include_flag() click to toggle source
# File lib/byebug/option_setter.rb, line 33
def include_flag
  @opts.on '-I', '--include list', 'Add to paths to $LOAD_PATH' do |list|
    $LOAD_PATH.push(list.split(':')).flatten!
  end
end
post_mortem() click to toggle source
# File lib/byebug/option_setter.rb, line 39
def post_mortem
  @opts.on '-m', '--[no-]post-mortem', 'Use post-mortem mode' do |v|
    Setting[:post_mortem] = v
  end
end
quit() click to toggle source
# File lib/byebug/option_setter.rb, line 45
def quit
  @opts.on '-q', '--[no-]quit', 'Quit when script finishes' do |v|
    @runner.quit = v
  end
end
rc() click to toggle source
# File lib/byebug/option_setter.rb, line 51
def rc
  @opts.on '-x', '--[no-]rc', 'Run byebug initialization file' do |v|
    @runner.init_script = v
  end
end
remote() click to toggle source
# File lib/byebug/option_setter.rb, line 69
def remote
  @opts.on '-R', '--remote [host:]port', 'Remote debug [host:]port' do |p|
    @runner.remote = p
  end
end
require_flag() click to toggle source
# File lib/byebug/option_setter.rb, line 63
def require_flag
  @opts.on '-r', '--require file', 'Require library before script' do |lib|
    require lib
  end
end
stop() click to toggle source
# File lib/byebug/option_setter.rb, line 57
def stop
  @opts.on '-s', '--[no-]stop', 'Stop when script is loaded' do |v|
    @runner.stop = v
  end
end
trace() click to toggle source
# File lib/byebug/option_setter.rb, line 75
def trace
  @opts.on '-t', '--[no-]trace', 'Turn on line tracing' do |v|
    Setting[:linetrace] = v
  end
end
version() click to toggle source
# File lib/byebug/option_setter.rb, line 81
def version
  @opts.on '-v', '--version', 'Print program version' do
    @runner.version = Byebug::VERSION
  end
end