cshannon commented on code in PR #5072:
URL: https://github.com/apache/accumulo/pull/5072#discussion_r1853901911
##########
shell/src/main/java/org/apache/accumulo/shell/commands/ListScansCommand.java:
##########
@@ -75,14 +77,31 @@ public int numArgs() {
public Options getOptions() {
final Options opts = new Options();
- tserverOption = new Option("ts", "tabletServer", true, "tablet server to
list scans for");
- tserverOption.setArgName("tablet server");
- opts.addOption(tserverOption);
+ serverOpt = new Option("s", "server", true, "tablet/scan server regex to
list scans for");
+ serverOpt.setArgName("tablet/scan server regex");
+ opts.addOption(serverOpt);
+
+ rgOpt = new Option("rg", "resourceGroup", true,
+ "tablet/scan server resource group regex to list scans for");
+ rgOpt.setArgName("resource group");
+ opts.addOption(rgOpt);
disablePaginationOpt = new Option("np", "no-pagination", false, "disable
pagination of output");
opts.addOption(disablePaginationOpt);
return opts;
}
+ static BiPredicate<String,Integer> serverRegexPredicate(CommandLine cl,
Option serverOpt) {
+ return Optional.ofNullable(cl.getOptionValue(serverOpt))
+ .map(regex -> (BiPredicate<String,
+ Integer>) (h, p) -> Pattern.compile(regex).matcher(h + ":" +
p).matches())
+ .orElse((h, p) -> true);
Review Comment:
That's a good point, it would definitely be better to not compile each time
even if it's just for the shell. The asMatchPredicate() was something i
discovered recently as well and is a nice API addition
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]