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 5
5
6
6
import java .util .Collections ;
7
7
import java .util .Map ;
8
+ import java .util .regex .Pattern ;
8
9
9
10
import com .oracle .weblogic .imagetool .api .model .CommandResponse ;
10
11
import com .oracle .weblogic .imagetool .util .Constants ;
11
12
import com .oracle .weblogic .imagetool .util .Utils ;
12
13
import picocli .CommandLine .Command ;
14
+ import picocli .CommandLine .Option ;
13
15
14
16
@ Command (
15
17
name = "listItems" ,
@@ -33,10 +35,19 @@ public CommandResponse call() {
33
35
System .out .println (Constants .CACHE_DIR_KEY + "=" + cacheDir );
34
36
resultMap .remove (Constants .CACHE_DIR_KEY );
35
37
}
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 );
37
43
38
44
return new CommandResponse (0 , "Cache contents" , resultMap );
39
45
}
40
46
}
41
47
48
+ @ Option (
49
+ names = {"--key" },
50
+ description = "list only cached items where the key matches this regex"
51
+ )
52
+ private String key ;
42
53
}
You can’t perform that action at this time.
0 commit comments