Class Grep

java.lang.Object
io.aeron.validation.Grep

public final class Grep extends Object
A utility class for running 'grep'.
  • Method Details

    • execute

      public static Grep execute(String pattern, String sourceDir)
      Parameters:
      pattern - the regex pattern passed to grep.
      sourceDir - the base directory where the search should begin.
      Returns:
      a Grep object with the results of the action.
    • success

      public boolean success()
      Returns:
      whether grep succeeded.
    • success

      public boolean success(boolean expectOneLine)
      Parameters:
      expectOneLine - many of the usages expect only a single line to be found. if more than one are found, that counts as a failure
      Returns:
      whether grep succeeded.
    • getCommandString

      public String getCommandString()
      Returns:
      the command string that was executed
    • getFilenameAndLine

      public String getFilenameAndLine()
      Returns:
      the filename and line number of the first line of output
    • getFilenameAndLine

      public String getFilenameAndLine(int lineNumber)
      Parameters:
      lineNumber - specify the line of output
      Returns:
      the filename and line number of the specified line of output
    • getOutput

      public String getOutput()
      Returns:
      the first line of output (minus the filename and line number)
    • getOutput

      public String getOutput(int lineNumber)
      Parameters:
      lineNumber - specify the line of output
      Returns:
      the output of the specified line number (minus the filename and the line number)
    • forEach

      public void forEach(BiConsumer<String,String> action)
      Parameters:
      action - a BiConsumer that consumes the filename/line number and output for each line of output