File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/cache Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 55
66import java .util .Collections ;
77import java .util .Map ;
8+ import java .util .regex .Pattern ;
89
910import com .oracle .weblogic .imagetool .api .model .CommandResponse ;
1011import com .oracle .weblogic .imagetool .util .Constants ;
1112import com .oracle .weblogic .imagetool .util .Utils ;
1213import picocli .CommandLine .Command ;
14+ import picocli .CommandLine .Option ;
1315
1416@ Command (
1517 name = "listItems" ,
@@ -33,10 +35,19 @@ public CommandResponse call() {
3335 System .out .println (Constants .CACHE_DIR_KEY + "=" + cacheDir );
3436 resultMap .remove (Constants .CACHE_DIR_KEY );
3537 }
36- resultMap .forEach ((key , value ) -> System .out .println (key + "=" + value ));
38+
39+ Pattern pattern = Pattern .compile (key == null ? ".*" : key );
40+ resultMap .entrySet ().stream ()
41+ .filter (entry -> pattern .matcher (entry .getKey ()).matches ())
42+ .forEach (System .out ::println );
3743
3844 return new CommandResponse (0 , "Cache contents" , resultMap );
3945 }
4046 }
4147
48+ @ Option (
49+ names = {"--key" },
50+ description = "list only cached items where the key matches this regex"
51+ )
52+ private String key ;
4253}
You can’t perform that action at this time.
0 commit comments