module Lambda

Constants

VERSION

Public Instance Methods

change_dir(dir) click to toggle source
# File lib/lambda.rb, line 18
def change_dir(dir)
    Dir.chdir(dir.strip)
end
main() click to toggle source
# File lib/lambda.rb, line 22
def main
    active = true
    while active
        print prompt
        cmd = gets.chomp

        case cmd.partition(' ')[0]
        when 'cd'
            change_dir(cmd.partition(' ')[2])
        when 'exit'
            active = false
        else
            system(cmd)
        end
    end
end
prompt() click to toggle source
# File lib/lambda.rb, line 9
def prompt
    user = Etc.getlogin
    dir = Dir.pwd

    prt = user.green + '@'.cyan + dir.blue + ' λ '.cyan
    return prt
end