66import java .util .concurrent .Callable ;
77
88import com .apicatalog .cborld .CborLd ;
9+ import com .apicatalog .cborld .config .DefaultConfig ;
10+ import com .apicatalog .cborld .db .DbConfig ;
11+ import com .apicatalog .cborld .decoder .DecoderConfig ;
912import com .apicatalog .cli .JsonOutput ;
10- import com .apicatalog .jsonld .document .Document ;
1113
1214import jakarta .json .JsonStructure ;
1315import jakarta .json .JsonValue ;
@@ -40,6 +42,12 @@ public final class DecompressCmd implements Callable<Integer> {
4042 @ Option (names = { "-b" , "--base" }, description = "input document base IRI" )
4143 URI base = null ;
4244
45+ @ Option (names = { "-a" , "--keep-arrays" }, description = "keep arrays with just one element" )
46+ boolean keepArrays = false ;
47+
48+ @ Option (names = { "-m" , "--mode" }, description = "processing mode" , paramLabel = "default|digitalbazaar" )
49+ String mode = "default" ;
50+
4351 @ Spec
4452 CommandSpec spec ;
4553
@@ -50,7 +58,17 @@ public Integer call() throws Exception {
5058
5159 byte [] encoded = Files .readAllBytes (input .toPath ());
5260
53- final JsonValue output = CborLd .decoder (encoded ).base (base ).decode ();
61+ DecoderConfig config = DefaultConfig .INSTANCE ;
62+
63+ if ("digitalbazaar" .equalsIgnoreCase (mode )) {
64+ config = DbConfig .INSTANCE ;
65+ }
66+
67+ final JsonValue output = CborLd .decoder (encoded )
68+ .config (config )
69+ .base (base )
70+ .compactArray (!keepArrays )
71+ .decode ();
5472
5573 JsonOutput .print ((JsonStructure )output , pretty );
5674
0 commit comments