java.lang.Object
org.apache.maven.shared.utils.cli.shell.Shell
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BourneShell, CmdShell, CommandShell

public class Shell extends Object implements Cloneable
Class that abstracts the Shell functionality, with subclasses for shells that behave particularly, like
  • command.com
  • cmd.exe
Author:
Carlos Sanchez
  • Constructor Details

    • Shell

      public Shell()
  • Method Details

    • quoteOneItem

      protected String quoteOneItem(String inputString, boolean isExecutable)
    • isDoubleQuotedArgumentEscaped

      protected boolean isDoubleQuotedArgumentEscaped()
      Returns:
      false in all cases
    • isSingleQuotedArgumentEscaped

      protected boolean isSingleQuotedArgumentEscaped()
      Returns:
      singleQuotedArgumentEscaped
    • getShellCommandLine

      public List<String> getShellCommandLine(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(String executable)
      Sets the executable to run.
      Parameters:
      executable - The executable.
    • getExecutable

      public String getExecutable()
      Returns:
      The executable.
    • setWorkingDirectory

      public void setWorkingDirectory(String path)
      Sets execution directory.
      Parameters:
      path - The path which should be used as working directory.
    • setWorkingDirectory

      public void setWorkingDirectory(File workingDirectory)
      Sets execution directory.
      Parameters:
      workingDirectory - the working directory
    • getWorkingDirectory

      public File getWorkingDirectory()
      Returns:
      the working directory
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • isUnconditionalQuoting

      public boolean isUnconditionalQuoting()
    • setUnconditionalQuoting

      public void setUnconditionalQuoting(boolean unconditionalQuoting)