Class: CmdWish

Inherits:
Djinni::Wish
  • Object
show all
Defined in:
lib/jenkins_shell/wish/cmd_wish.rb

Instance Method Summary collapse

Instance Method Details

#aliasesObject



4
5
6
# File 'lib/jenkins_shell/wish/cmd_wish.rb', line 4

def aliases
    return ["cmd"]
end

#descriptionObject



8
9
10
# File 'lib/jenkins_shell/wish/cmd_wish.rb', line 8

def description
    return "Run command as if in cmd (default behavior)"
end

#execute(args, djinni_env = Hash.new) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jenkins_shell/wish/cmd_wish.rb', line 12

def execute(args, djinni_env = Hash.new)
    usage if (args.empty?)

    jsh = djinni_env["jsh"]
    puts jsh.command(args)

    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

#usageObject



26
27
28
29
# File 'lib/jenkins_shell/wish/cmd_wish.rb', line 26

def usage
    puts "#{aliases.join(", ")} <commands>"
    puts "    #{description}."
end