Class ScriptCommandLine
java.lang.Object
com.anrisoftware.globalpom.exec.internal.script.ScriptCommandLine
- All Implemented Interfaces:
CommandLine
Quotes command line arguments.
- Since:
- 2.0
- Author:
- Erwin Mueller, erwin.mueller@deventm.org
-
Method Summary
Modifier and TypeMethodDescriptionAdds the specified command line argument.Adds the specified command line arguments.Adds the specified command line argument.Adds the specified command line arguments.Adds a variable substitution for the arguments.static CommandLinecreateScriptCommandLine(String name, com.anrisoftware.resources.templates.external.TemplateResource template) Returns the arguments.Returns the of the command list.Returns the executable.com.anrisoftware.resources.templates.external.TemplateResourceReturns the working directory.voidsetVariableStartChar(char character) Sets the variable substitution start character.voidsetVariableStopChar(char character) Sets the variable substitution stop character.voidsetWorkingDir(File dir) Sets the working directory.toString()
-
Method Details
-
createScriptCommandLine
public static CommandLine createScriptCommandLine(String name, com.anrisoftware.resources.templates.external.TemplateResource template) - Parameters:
name- theStringtemplate name.template- theTemplateResourcetemplate resource.- Returns:
- the
CommandLine - See Also:
-
getCommand
Description copied from interface:CommandLineReturns the of the command list.- Specified by:
getCommandin interfaceCommandLine- Returns:
- the unmodifiable
ListofStringthat contains the executable as the first item and the command arguments as the rest. - Throws:
CommandExecException- if there was an error create the command.
-
getExecutable
Description copied from interface:CommandLineReturns the executable.- Specified by:
getExecutablein interfaceCommandLine- Returns:
- the
Objectexecutable to run, can be the name of the executable or the path or any other abstract object.
-
getArguments
Description copied from interface:CommandLineReturns the arguments.- Specified by:
getArgumentsin interfaceCommandLine- Returns:
- the unmodifiable
Listof arguments.
-
add
Description copied from interface:CommandLineAdds the specified command line arguments.- Specified by:
addin interfaceCommandLine- Parameters:
arguments- theObjectarray arguments.- Returns:
- this
DefaultCommandLine.
-
add
Description copied from interface:CommandLineAdds the specified command line arguments.- Specified by:
addin interfaceCommandLine- Parameters:
quote- set totrueto quote the argument.arguments- theObjectarray arguments.- Returns:
- this
DefaultCommandLine.
-
add
Description copied from interface:CommandLineAdds the specified command line argument.- Specified by:
addin interfaceCommandLine- Parameters:
argument- theObjectargument.- Returns:
- this
DefaultCommandLine.
-
add
Description copied from interface:CommandLineAdds the specified command line argument. If the quote arguments is set then the arguments is quoted in double/single quotes.aaa->aaaaaa bbb->"aaa bbb""aaa" bbb->'"aaa" bbb'"aaa ccc" bbb->'"aaa ccc" bbb'"aaa"bbb->'"aaa"bbb'
- Specified by:
addin interfaceCommandLine- Parameters:
quote- set totrueto quote the argument.argument- theObjectargument.- Returns:
- this
DefaultCommandLine.
-
addSub
Description copied from interface:CommandLineAdds a variable substitution for the arguments. The variables are only substituted when the arguments are returned. The variables must be enclosed in the enclose"<", ">", for example:"foo=<bar>".- Specified by:
addSubin interfaceCommandLine- Parameters:
name- theStringname of the variable.value- theObjectvalue of the variable.- Returns:
- this
DefaultCommandLine.
-
setWorkingDir
Description copied from interface:CommandLineSets the working directory.- Specified by:
setWorkingDirin interfaceCommandLine- Parameters:
dir- theFiledirectory ornullto use the working directory of the current Java process.
-
getWorkingDir
Description copied from interface:CommandLineReturns the working directory.- Specified by:
getWorkingDirin interfaceCommandLine- Returns:
- the
Filedirectory ornullto use the working directory of the current Java process.
-
setVariableStartChar
public void setVariableStartChar(char character) Description copied from interface:CommandLineSets the variable substitution start character. The start character defaults to"<".- Specified by:
setVariableStartCharin interfaceCommandLine- Parameters:
character- the character.
-
setVariableStopChar
public void setVariableStopChar(char character) Description copied from interface:CommandLineSets the variable substitution stop character. The stop character defaults to">".- Specified by:
setVariableStopCharin interfaceCommandLine- Parameters:
character- the character.
-
getTemplate
public com.anrisoftware.resources.templates.external.TemplateResource getTemplate() -
toString
- Specified by:
toStringin interfaceCommandLine- Overrides:
toStringin classObject
-