Sha256: 6b6569cf951cbca5a16f8091a436b7879f34e60ff60cf0e8c21eb44f1b30638a

Contents?: true

Size: 1.84 KB

Versions: 6505

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

module Byebug
  #
  # Handles byebug's command line options
  #
  class OptionSetter
    def initialize(runner, opts)
      @runner = runner
      @opts = opts
    end

    def setup
      debug
      include_flag
      post_mortem
      quit
      rc
      stop
      require_flag
      remote
      trace
      version
      help
    end

    private

    def debug
      @opts.on "-d", "--debug", "Set $DEBUG=true" do
        $DEBUG = true
      end
    end

    def include_flag
      @opts.on "-I", "--include list", "Add to paths to $LOAD_PATH" do |list|
        $LOAD_PATH.push(list.split(":")).flatten!
      end
    end

    def post_mortem
      @opts.on "-m", "--[no-]post-mortem", "Use post-mortem mode" do |v|
        Setting[:post_mortem] = v
      end
    end

    def quit
      @opts.on "-q", "--[no-]quit", "Quit when script finishes" do |v|
        @runner.quit = v
      end
    end

    def rc
      @opts.on "-x", "--[no-]rc", "Run byebug initialization file" do |v|
        @runner.init_script = v
      end
    end

    def stop
      @opts.on "-s", "--[no-]stop", "Stop when script is loaded" do |v|
        @runner.stop = v
      end
    end

    def require_flag
      @opts.on "-r", "--require file", "Require library before script" do |lib|
        require lib
      end
    end

    def remote
      @opts.on "-R", "--remote [host:]port", "Remote debug [host:]port" do |p|
        @runner.remote = p
      end
    end

    def trace
      @opts.on "-t", "--[no-]trace", "Turn on line tracing" do |v|
        Setting[:linetrace] = v
      end
    end

    def version
      @opts.on "-v", "--version", "Print program version" do
        @runner.version = Byebug::VERSION
      end
    end

    def help
      @opts.on "-h", "--help", "Display this message" do
        @runner.help = @opts.help
      end
    end
  end
end

Version data entries

6,505 entries across 6,501 versions & 34 rubygems

Version Path
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_bank_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_organization_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_id_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_bank_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_organization_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_id_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_id_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_bank_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_organization_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_organization_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_id_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_bank_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
ory-client-1.15.12 vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_bank_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_id_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_organization_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_bank_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_organization_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/byebug-11.1.3/lib/byebug/option_setter.rb