Class CmdLine

java.lang.Object
com.diffplug.gradle.CmdLine

public class CmdLine extends Object
Implementation of CmdLineTask, but helpful for implementing other things as well.
  • Constructor Details

    • CmdLine

      public CmdLine()
  • Method Details

    • 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.
    • copy

      public void copy(File src, File dst)
      Removes the given file or directory.
    • mv

      public void mv(File src, File dst)
      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