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 classCmdLine.ResultReturns the given result.static classCmdLine.SerializableAction
-
Constructor Summary
Constructors Constructor Description CmdLine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanDir(File dir)voidcmd(File workingDir, String cmd)Sets the working directory to the given dir, then executes the given command.voidcmd(String cmd)Executes the given command.voidcopy(File src, File dst)Removes the given file or directory.voidechoCmd(boolean echoCmd)Determines whether commands are echoed.voidechoOutput(boolean echoOutput)Determines whether the output of commands are echoed.voidmv(File src, File dst)Removes the given file or directory.voidperformActions()Runs the commands that have been queued up.voidrm(File fileOrDir)Removes the given file or directory.voidrun(CmdLine.SerializableAction action)Removes the given file or directory.voidrun(groovy.lang.Closure<?> action)Removes the given file or directory.static CmdLine.ResultrunCmd(File directory, String cmd)Runs the given command in the given directory.static CmdLine.ResultrunCmd(File directory, String cmd, boolean echoCmd, boolean echoOutput)Runs the given command in the given directory with the given echo setting.static CmdLine.ResultrunCmd(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 ThrowableRuns 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
-
-