org.codehaus.plexus.util.cli.shell

Class Shell

public class Shell extends Object

Class that abstracts the Shell functionality, with subclases for shells that behave particularly, like

Since: 1.2

Author: Carlos Sanchez

Field Summary
String[]shellArgs
StringshellCommand
Method Summary
ListgetCommandLine(String executable, String[] arguments)
Get the command line for the provided executable and arguments in this shell
String[]getShellArgs()
Get the shell arguments
StringgetShellCommand()
Get the command to execute the shell
ListgetShellCommandLine(String executable, String[] arguments)
Get the full command line to execute, including shell command, shell arguments, executable and executable arguments
voidsetShellArgs(String[] shellArgs)
Set the shell arguments when calling a command line (not the executable arguments) (eg.
voidsetShellCommand(String shellCommand)
Set the command to execute the shell (eg.

Field Detail

shellArgs

private String[] shellArgs

shellCommand

private String shellCommand

Method Detail

getCommandLine

public List getCommandLine(String executable, String[] arguments)
Get the command line for the provided executable and arguments in this shell

Parameters: executable executable that the shell has to call arguments arguments for the executable, not the shell

Returns: List with one String object with executable and arguments quoted as needed

getShellArgs

public String[] getShellArgs()
Get the shell arguments

Returns:

getShellCommand

public String getShellCommand()
Get the command to execute the shell

Returns:

getShellCommandLine

public List getShellCommandLine(String executable, String[] arguments)
Get the full command line to execute, including shell command, shell arguments, executable and executable arguments

Parameters: executable executable that the shell has to call 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()

setShellArgs

public void setShellArgs(String[] shellArgs)
Set the shell arguments when calling a command line (not the executable arguments) (eg. /X /C for CMD.EXE)

Parameters: shellArgs

setShellCommand

public void setShellCommand(String shellCommand)
Set the command to execute the shell (eg. COMMAND.COM, /bin/bash,...)

Parameters: shellCommand