Class Shell
- java.lang.Object
-
- org.apache.maven.shared.utils.cli.shell.Shell
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
BourneShell
,CmdShell
,CommandShell
public class Shell extends java.lang.Object implements java.lang.Cloneable
Class that abstracts the Shell functionality, with subclases for shells that behave particularly, like
command.com
cmd.exe
- Author:
- Carlos Sanchez
-
-
Constructor Summary
Constructors Constructor Description Shell()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
java.lang.String
getExecutable()
java.util.List<java.lang.String>
getShellCommandLine(java.lang.String... arguments)
Get the full command line to execute, including shell command, shell arguments, executable and executable argumentsjava.io.File
getWorkingDirectory()
protected boolean
isDoubleQuotedArgumentEscaped()
protected boolean
isSingleQuotedArgumentEscaped()
boolean
isUnconditionalQuoting()
protected java.lang.String
quoteOneItem(java.lang.String inputString, boolean isExecutable)
void
setExecutable(java.lang.String executable)
Sets the executable to run.void
setQuotedArgumentsEnabled(boolean quotedArgumentsEnabled)
void
setUnconditionalQuoting(boolean unconditionalQuoting)
void
setWorkingDirectory(java.io.File workingDirectory)
Sets execution directory.void
setWorkingDirectory(java.lang.String path)
Sets execution directory.
-
-
-
Method Detail
-
quoteOneItem
protected java.lang.String quoteOneItem(java.lang.String inputString, boolean isExecutable)
-
isDoubleQuotedArgumentEscaped
protected boolean isDoubleQuotedArgumentEscaped()
- Returns:
- false in all cases.
-
isSingleQuotedArgumentEscaped
protected boolean isSingleQuotedArgumentEscaped()
- Returns:
singleQuotedArgumentEscaped
-
getShellCommandLine
public java.util.List<java.lang.String> getShellCommandLine(java.lang.String... arguments)
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
public void setExecutable(java.lang.String executable)
Sets the executable to run.- Parameters:
executable
- The executable.
-
getExecutable
public java.lang.String getExecutable()
- Returns:
- The executable.
-
setWorkingDirectory
public void setWorkingDirectory(java.lang.String path)
Sets execution directory.- Parameters:
path
- The path which should be used as working directory.
-
setWorkingDirectory
public void setWorkingDirectory(java.io.File workingDirectory)
Sets execution directory.- Parameters:
workingDirectory
- The working directory.
-
getWorkingDirectory
public java.io.File getWorkingDirectory()
- Returns:
- The working directory.
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
isUnconditionalQuoting
public boolean isUnconditionalQuoting()
-
setUnconditionalQuoting
public void setUnconditionalQuoting(boolean unconditionalQuoting)
-
-