Sha256: 2473562a9bbdaccf48cd7721451b20bd23d73ac59437d0305a1d32f7d725190d

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

require "readline"

class Ppl::Command::Shell < Ppl::Application::Command

  attr_writer :format

  def initialize
    @name        = "shell"
    @description = "Interactive mode"
  end

  def options(parser, options)
    parser.banner = "usage: ppl shell"
  end

  def execute(input, output)
    begin
      while line = Readline.readline("ppl> ", true)
        break if line == "exit"
        break if line == false
        Kernel.system "#{$0} #{line}"
      end
    rescue SystemExit, Interrupt
      output.line("")
      return false
    end

    if $stdin.tty?
      output.line("")
    end
    return true
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ppl-1.5.1 lib/ppl/command/shell.rb
ppl-1.5.0 lib/ppl/command/shell.rb