Class Shell
java.lang.Object
org.apache.maven.shared.utils.cli.shell.Shell
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
BourneShell,CmdShell,CommandShell
Class that abstracts the Shell functionality,
with subclasses for shells that behave particularly, like
command.comcmd.exe
- Author:
- Carlos Sanchez
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()getShellCommandLine(String... arguments) Get the full command line to execute, including shell command, shell arguments, executable and executable argumentsprotected booleanprotected booleanbooleanprotected StringquoteOneItem(String inputString, boolean isExecutable) voidsetExecutable(String executable) Sets the executable to run.voidsetQuotedArgumentsEnabled(boolean quotedArgumentsEnabled) voidsetUnconditionalQuoting(boolean unconditionalQuoting) voidsetWorkingDirectory(File workingDirectory) Sets execution directory.voidsetWorkingDirectory(String path) Sets execution directory.
-
Constructor Details
-
Shell
public Shell()
-
-
Method Details
-
quoteOneItem
-
isDoubleQuotedArgumentEscaped
protected boolean isDoubleQuotedArgumentEscaped()- Returns:
- false in all cases
-
isSingleQuotedArgumentEscaped
protected boolean isSingleQuotedArgumentEscaped()- Returns:
singleQuotedArgumentEscaped
-
getShellCommandLine
Get the full command line to execute, including shell command, shell arguments, executable and executable arguments- Parameters:
arguments- arguments for the executable, not the shell- Returns:
- List of String objects, whose array version is suitable to be used as argument of Runtime.getRuntime().exec()
-
setQuotedArgumentsEnabled
public void setQuotedArgumentsEnabled(boolean quotedArgumentsEnabled) - Parameters:
quotedArgumentsEnabled-quotedArgumentsEnabled
-
setExecutable
Sets the executable to run.- Parameters:
executable- The executable.
-
getExecutable
- Returns:
- The executable.
-
setWorkingDirectory
Sets execution directory.- Parameters:
path- The path which should be used as working directory.
-
setWorkingDirectory
Sets execution directory.- Parameters:
workingDirectory- the working directory
-
getWorkingDirectory
- Returns:
- the working directory
-
clone
-
isUnconditionalQuoting
public boolean isUnconditionalQuoting() -
setUnconditionalQuoting
public void setUnconditionalQuoting(boolean unconditionalQuoting)
-