public class CommandLineBuilder
extends java.lang.Object
| Constructor and Description |
|---|
CommandLineBuilder() |
CommandLineBuilder(java.lang.String bin) |
| Modifier and Type | Method and Description |
|---|---|
void |
addArg(java.lang.String arg)
Add a simple argument to the command line.
|
void |
addEqualsArg(java.lang.String name,
java.lang.String value)
Similar to
addArg(String) but concats both name + value with an "=" sign, quoting were needed, and excluding the "=" portion if the value is
undefined or empty. |
void |
addRawArg(java.lang.String arg)
Add a simple argument to the command line.
|
void |
debug() |
static java.io.File |
findExecutable(java.io.File root,
java.lang.String path) |
static java.lang.String |
findJavaBin() |
java.util.List<java.lang.String> |
getArgs() |
static java.lang.String |
quote(java.lang.String arg)
Perform an optional quoting of the argument, being intelligent with spaces and quotes as needed.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String delim) |
public CommandLineBuilder()
public CommandLineBuilder(java.lang.String bin)
public static java.io.File findExecutable(java.io.File root,
java.lang.String path)
public static java.lang.String findJavaBin()
public static java.lang.String quote(java.lang.String arg)
arg - the argument to quotepublic void addArg(java.lang.String arg)
Will quote arguments that have a space in them.
arg - the simple argument to addpublic void addEqualsArg(java.lang.String name,
java.lang.String value)
addArg(String) but concats both name + value with an "=" sign, quoting were needed, and excluding the "=" portion if the value is
undefined or empty.
addEqualsArg("-Dname", "value") = "-Dname=value"
addEqualsArg("-Djetty.home", "/opt/company inc/jetty (7)/") = "-Djetty.home=/opt/company\ inc/jetty\ (7)/"
addEqualsArg("-Djenkins.workspace", "/opt/workspaces/jetty jdk7/") = "-Djenkins.workspace=/opt/workspaces/jetty\ jdk7/"
addEqualsArg("-Dstress", null) = "-Dstress"
addEqualsArg("-Dstress", "") = "-Dstress"
name - the namevalue - the valuepublic void addRawArg(java.lang.String arg)
Will NOT quote/escape arguments that have a space in them.
arg - the simple argument to addpublic java.util.List<java.lang.String> getArgs()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(java.lang.String delim)
public void debug()
Copyright © 1995–2021 Webtide. All rights reserved.