class Exa::Shell

Attributes

pwd[R]

Public Class Methods

new(pwd) click to toggle source
# File lib/exa/shell.rb, line 51
def initialize(pwd)
  @pwd = pwd
end
repl!() { |configuration| ... } click to toggle source
# File lib/exa/shell.rb, line 101
def self.repl!
  shell = new(Exa['/'])
  yield shell.configuration
  shell.kickstart!
end

Public Instance Methods

change_directory(target) click to toggle source
# File lib/exa/shell.rb, line 73
def change_directory(target)
  @pwd = target
end
configuration() click to toggle source
# File lib/exa/shell.rb, line 55
def configuration
  @config ||= ShellConfig.new
end
kickstart!() click to toggle source
# File lib/exa/shell.rb, line 59
def kickstart!
  loop do
    print configuration.prompt.call(self)
    inp = gets.chomp
    outp = shell_eval(inp)
    p outp unless outp.nil? || (outp.respond_to?(:empty?) && outp.empty?)
  end
end
pastel() click to toggle source
# File lib/exa/shell.rb, line 97
def pastel
  @pastel ||= Pastel.new
end
print_collection(elements) click to toggle source
print_info(message) click to toggle source
print_warning(message) click to toggle source
shell_eval(cmd_str) click to toggle source
# File lib/exa/shell.rb, line 68
def shell_eval(cmd_str)
  cmd = ShellCommand.extract(cmd_str)
  cmd.evaluate(self)
end