Search in sources :

Example 1 with PasswordArgument

use of com.thoughtworks.go.util.command.PasswordArgument in project gocd by gocd.

the class P4Client method p4.

CommandLine p4(String command, String... params) {
    Map<String, String> env = new HashMap<>();
    env.put("P4PORT", p4Port);
    env.put("P4CLIENT", p4ClientName);
    if (hasUser()) {
        env.put("P4USER", p4user);
    }
    if (usingPassword()) {
        env.put("P4PASSWD", p4passwd);
    }
    CommandLine line = createCommandLine("p4").withArgs(command).withArgs(params).withEnv(env);
    if (hasPassword()) {
        line = line.withNonArgSecret(new PasswordArgument(p4passwd));
    }
    return line;
}
Also used : CommandLine(com.thoughtworks.go.util.command.CommandLine) CommandLine.createCommandLine(com.thoughtworks.go.util.command.CommandLine.createCommandLine) PasswordArgument(com.thoughtworks.go.util.command.PasswordArgument) HashMap(java.util.HashMap)

Aggregations

CommandLine (com.thoughtworks.go.util.command.CommandLine)1 CommandLine.createCommandLine (com.thoughtworks.go.util.command.CommandLine.createCommandLine)1 PasswordArgument (com.thoughtworks.go.util.command.PasswordArgument)1 HashMap (java.util.HashMap)1