Package io.aeron.validation
Class Grep
java.lang.Object
io.aeron.validation.Grep
A utility class for running 'grep'.
-
Method Summary
Modifier and TypeMethodDescriptionstatic GrepvoidforEach(BiConsumer<String, String> action) getFilenameAndLine(int lineNumber) getOutput(int lineNumber) booleansuccess()booleansuccess(boolean expectOneLine)
-
Method Details
-
execute
- 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
- Returns:
- the command string that was executed
-
getFilenameAndLine
- Returns:
- the filename and line number of the first line of output
-
getFilenameAndLine
- Parameters:
lineNumber- specify the line of output- Returns:
- the filename and line number of the specified line of output
-
getOutput
- Returns:
- the first line of output (minus the filename and line number)
-
getOutput
- Parameters:
lineNumber- specify the line of output- Returns:
- the output of the specified line number (minus the filename and the line number)
-
forEach
- Parameters:
action- a BiConsumer that consumes the filename/line number and output for each line of output
-