class CDWish

Public Instance Methods

aliases() click to toggle source
# File lib/jenkins_shell/wish/cd_wish.rb, line 5
def aliases
    return ["cd"]
end
description() click to toggle source
# File lib/jenkins_shell/wish/cd_wish.rb, line 9
def description
    return "Change to new directory"
end
execute(args, djinni_env = Hash.new) click to toggle source
# File lib/jenkins_shell/wish/cd_wish.rb, line 13
def execute(args, djinni_env = Hash.new)
    case djinni_env["os"]
    when JenkinsShell::OS.LINUX
        puts "Currently unsupported for Linux"
        return
    end

    usage if (args.empty?)

    jsh = djinni_env["jsh"]
    if (!jsh.cd(args))
        puts "Directory not found"
        return
    end

    case djinni_env["os"]
    when JenkinsShell::OS.LINUX
        djinni_env["djinni_prompt"] = "#{jsh.cwd}$ ".light_white
    when JenkinsShell::OS.WINDOWS
        djinni_env["djinni_prompt"] = "#{jsh.cwd}> ".light_white
    end
end
usage() click to toggle source
# File lib/jenkins_shell/wish/cd_wish.rb, line 36
def usage
    puts "#{aliases.join(", ")} <directory>"
    puts "    #{description}."
end