public class CmdLine extends Object
Implementation of CmdLineTask
, but helpful for implementing other things as well.
Modifier and Type | Class and Description |
---|---|
static class |
CmdLine.Result
Returns the given result.
|
Constructor and Description |
---|
CmdLine() |
Modifier and Type | Method and Description |
---|---|
void |
cmd(File workingDir,
String cmd)
Sets the working directory to the given dir, then executes the given command.
|
void |
cmd(String cmd)
Executes the given command.
|
void |
copy(File src,
File dst)
Removes the given file or directory.
|
void |
echoCmd(boolean echoCmd)
Determines whether commands are echoed.
|
void |
echoOutput(boolean echoOutput)
Determines whether the output of commands are echoed.
|
void |
mv(File src,
File dst)
Removes the given file or directory.
|
void |
performActions()
Runs the commands that have been queued up.
|
void |
rm(File fileOrDir)
Removes the given file or directory.
|
void |
run(Throwing.Runnable action)
Removes the given file or directory.
|
static CmdLine.Result |
runCmd(File directory,
String cmd)
Runs the given command in the given directory.
|
static CmdLine.Result |
runCmd(File directory,
String cmd,
boolean echoCmd,
boolean echoOutput)
Runs the given command in the given directory with the given echo setting.
|
static CmdLine.Result |
runCmd(String cmd)
Runs the given command in the current working directory.
|
public void echoCmd(boolean echoCmd)
Determines whether commands are echoed. Default value is true.
public void echoOutput(boolean echoOutput)
Determines whether the output of commands are echoed. Default value is true.
public void cmd(String cmd)
Executes the given command.
public void cmd(File workingDir, String cmd)
Sets the working directory to the given dir, then executes the given command.
public void rm(File fileOrDir)
Removes the given file or directory.
public void run(Throwing.Runnable action)
Removes the given file or directory.
public void performActions() throws Throwable
Runs the commands that have been queued up.
Throwable
public static CmdLine.Result runCmd(String cmd) throws IOException
Runs the given command in the current working directory.
IOException
public static CmdLine.Result runCmd(File directory, String cmd) throws IOException
Runs the given command in the given directory.
IOException
public static CmdLine.Result runCmd(File directory, String cmd, boolean echoCmd, boolean echoOutput) throws IOException
Runs the given command in the given directory with the given echo setting.
IOException