Sha256: 1a9cedbac25ef8571782ff4cb80f9438b63d553676da9f1252240e1806b5567f

Contents?: true

Size: 851 Bytes

Versions: 6

Compression:

Stored size: 851 Bytes

Contents

module Byebug

  # Implements byebug "quit" command
  class QuitCommand < Command
    self.allow_in_control = true

    def regexp
      / ^\s*
         (?:q(?:uit)?|exit) \s*
         (!|\s+unconditionally)? \s*
         $
      /ix
    end

    def execute
      if @match[1] or confirm("Really quit? (y/n) ") 
        @state.interface.finalize
        exit! # exit -> exit!: No graceful way to stop threads...
      end
    end

    class << self
      def help_command
        %w[quit exit]
      end

      def help(cmd)
        %{
          q[uit] [!|unconditionally]\texit from byebug. 
          exit[!]\talias to quit

          Normally we prompt before exiting. However if the parameter
          "unconditionally" or is given or suffixed with !, we stop
          without asking further questions.  
         }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
byebug-1.1.0 lib/byebug/commands/quit.rb
byebug-1.0.3 lib/byebug/commands/quit.rb
byebug-1.0.2 lib/byebug/commands/quit.rb
byebug-1.0.1 lib/byebug/commands/quit.rb
byebug-1.0.0 lib/byebug/commands/quit.rb
byebug-0.0.1 lib/byebug/commands/quit.rb