keith-turner commented on a change in pull request #519: Add filter to 
listcompactions
URL: https://github.com/apache/accumulo/pull/519#discussion_r193429710
 
 

 ##########
 File path: 
shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
 ##########
 @@ -54,7 +58,17 @@ public int execute(final String fullCommand, final 
CommandLine cl, final Shell s
       tservers = instanceOps.getTabletServers();
     }
 
-    shellState.printLines(new ActiveCompactionIterator(tservers, instanceOps), 
paginate);
+    if (cl.hasOption(filterOption.getOpt())) {
+      filterText = cl.getOptionValue(filterOption.getOpt());
+    }
+    Iterator<String> activeCompactionIterator = new 
ActiveCompactionIterator(tservers, instanceOps);
+    if (filterText != null) {
+      String finalFilterText = filterText;
+      activeCompactionIterator = Iterators.filter(activeCompactionIterator,
+          t -> t.contains(finalFilterText));
 
 Review comment:
   Could do a regex instead of contains.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to