Package com.diffplug.gradle
Class CmdLine
- java.lang.Object
-
- com.diffplug.gradle.CmdLine
-
public class CmdLine extends Object
Implementation ofCmdLineTask
, but helpful for implementing other things as well.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmdLine.Result
Returns the given result.static class
CmdLine.SerializableAction
-
Constructor Summary
Constructors Constructor Description CmdLine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanDir(File dir)
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(CmdLine.SerializableAction action)
Removes the given file or directory.void
run(groovy.lang.Closure<?> 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.
-
-
-
Method Detail
-
echoCmd
public void echoCmd(boolean echoCmd)
Determines whether commands are echoed. Default value is true.
-
echoOutput
public void echoOutput(boolean echoOutput)
Determines whether the output of commands are echoed. Default value is true.
-
cmd
public void cmd(String cmd)
Executes the given command.
-
cmd
public void cmd(File workingDir, String cmd)
Sets the working directory to the given dir, then executes the given command.
-
cleanDir
public void cleanDir(File dir)
-
rm
public void rm(File fileOrDir)
Removes the given file or directory.
-
run
public void run(groovy.lang.Closure<?> action)
Removes the given file or directory.
-
run
public void run(CmdLine.SerializableAction action)
Removes the given file or directory.
-
performActions
public void performActions() throws Throwable
Runs the commands that have been queued up.- Throws:
Throwable
-
runCmd
public static CmdLine.Result runCmd(String cmd) throws IOException
Runs the given command in the current working directory.- Throws:
IOException
-
runCmd
public static CmdLine.Result runCmd(File directory, String cmd) throws IOException
Runs the given command in the given directory.- Throws:
IOException
-
runCmd
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.- Throws:
IOException
-
-