Sha256: dd7c7057a961946d17b2683f51f5b298bfa8136d9fa5dfcb0e2f966c64feb4fd

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

class Log2mail::Console

  require_relative 'console/logger'
  require_relative 'console/commands'
  include Log2mail::Console::Commands
  require 'highline/import'

  def run

    # PFUSCH!!!
    # Log2mail::Config.extend Log2mail::Console::Logger
    # Log2mail::Config.include Log2mail::Console::Logger

    loop do
      input = ask('log2mail.rb % ').chomp
      # command, *params = input.split /\s/
      command = input
      next if command.empty?
      command.gsub!(' ', '_')
      (quit; return) if ['quit', 'exit'].include?(command)
      if self.commands.include?(command)
        send(command)
      else
        puts "Unknown command. Use 'help' for more information."
      end
    end
  rescue EOFError
    quit; return
  end

  def quit
    puts "quitting..."
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
log2mail-0.0.1.pre4 lib/log2mail/console.rb
log2mail-0.0.1.pre3 lib/log2mail/console.rb
log2mail-0.0.1.pre2 lib/log2mail/console.rb