@@ -132,14 +132,19 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
132132 */
133133 public readonly defaultTag : string = 'latest' ;
134134
135+ /**
136+ * The default argument given to `--format`
137+ */
138+ protected readonly defaultFormatForJson : string = "{{json .}}" ;
139+
135140 //#region Information Commands
136141
137142 protected getInfoCommandArgs (
138143 options : InfoCommandOptions ,
139144 ) : CommandLineArgs {
140145 return composeArgs (
141146 withArg ( 'info' ) ,
142- withDockerJsonFormatArg ,
147+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
143148 ) ( ) ;
144149 }
145150
@@ -173,7 +178,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
173178 protected getVersionCommandArgs ( options : VersionCommandOptions ) : CommandLineArgs {
174179 return composeArgs (
175180 withArg ( 'version' ) ,
176- withDockerJsonFormatArg ,
181+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
177182 ) ( ) ;
178183 }
179184
@@ -243,7 +248,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
243248 withDockerLabelFilterArgs ( options . labels ) ,
244249 withDockerFilterArg ( options . types ?. map ( ( type ) => `type=${ type } ` ) ) ,
245250 withDockerFilterArg ( options . events ?. map ( ( event ) => `event=${ event } ` ) ) ,
246- withDockerJsonFormatArg ,
251+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
247252 ) ( ) ;
248253 }
249254
@@ -391,7 +396,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
391396 withDockerFilterArg ( options . references ?. map ( ( reference ) => `reference=${ reference } ` ) ) ,
392397 withDockerLabelFilterArgs ( options . labels ) ,
393398 withDockerNoTruncArg ,
394- withDockerJsonFormatArg ,
399+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
395400 ) ( ) ;
396401 }
397402
@@ -462,7 +467,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
462467
463468 protected getRemoveImagesCommandArgs ( options : RemoveImagesCommandOptions ) : CommandLineArgs {
464469 return composeArgs (
465- withArg ( 'image' , 'remove ' ) ,
470+ withArg ( 'image' , 'rm ' ) , // Docker supports both `remove` and `rm`, but Podman supports only `rm`
466471 withFlagArg ( '--force' , options . force ) ,
467472 withArg ( ...options . imageRefs ) ,
468473 ) ( ) ;
@@ -602,7 +607,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
602607 ) : CommandLineArgs {
603608 return composeArgs (
604609 withArg ( 'image' , 'inspect' ) ,
605- withDockerJsonFormatArg ,
610+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
606611 withArg ( ...options . imageRefs ) ,
607612 ) ( ) ;
608613 }
@@ -770,7 +775,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
770775 withDockerFilterArg ( options . volumes ?. map ( ( volume ) => `volume=${ volume } ` ) ) ,
771776 withDockerFilterArg ( options . networks ?. map ( ( network ) => `network=${ network } ` ) ) ,
772777 withDockerNoTruncArg ,
773- withDockerJsonFormatArg ,
778+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
774779 withDockerIgnoreSizeArg ,
775780 ) ( ) ;
776781 }
@@ -1046,7 +1051,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
10461051 ) : CommandLineArgs {
10471052 return composeArgs (
10481053 withArg ( 'container' , 'inspect' ) ,
1049- withDockerJsonFormatArg ,
1054+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
10501055 withArg ( ...options . containers )
10511056 ) ( ) ;
10521057 }
@@ -1117,7 +1122,6 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
11171122 withArg ( 'volume' , 'create' ) ,
11181123 withNamedArg ( '--driver' , options . driver ) ,
11191124 withArg ( options . name ) ,
1120- withDockerJsonFormatArg ,
11211125 ) ( ) ;
11221126 }
11231127
@@ -1138,11 +1142,11 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
11381142 withDockerBooleanFilterArg ( 'dangling' , options . dangling ) ,
11391143 withDockerFilterArg ( options . driver ? `driver=${ options . driver } ` : undefined ) ,
11401144 withDockerLabelFilterArgs ( options . labels ) ,
1141- withDockerJsonFormatArg ,
1145+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
11421146 ) ( ) ;
11431147 }
11441148
1145- protected async parseListVolumesCommandOputput (
1149+ protected async parseListVolumesCommandOutput (
11461150 options : ListVolumesCommandOptions ,
11471151 output : string ,
11481152 strict : boolean ,
@@ -1198,7 +1202,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
11981202 return {
11991203 command : this . commandName ,
12001204 args : this . getListVolumesCommandArgs ( options ) ,
1201- parse : ( output , strict ) => this . parseListVolumesCommandOputput ( options , output , strict ) ,
1205+ parse : ( output , strict ) => this . parseListVolumesCommandOutput ( options , output , strict ) ,
12021206 } ;
12031207 }
12041208
@@ -1292,7 +1296,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
12921296 ) : CommandLineArgs {
12931297 return composeArgs (
12941298 withArg ( 'volume' , 'inspect' ) ,
1295- withDockerJsonFormatArg ,
1299+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
12961300 withArg ( ...options . volumes ) ,
12971301 ) ( ) ;
12981302 }
@@ -1375,7 +1379,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
13751379 withArg ( 'network' , 'ls' ) ,
13761380 withDockerLabelFilterArgs ( options . labels ) ,
13771381 withDockerNoTruncArg ,
1378- withDockerJsonFormatArg ,
1382+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
13791383 ) ( ) ;
13801384 }
13811385
@@ -1495,7 +1499,7 @@ export abstract class DockerClientBase extends ConfigurableClient implements ICo
14951499 ) : CommandLineArgs {
14961500 return composeArgs (
14971501 withArg ( 'network' , 'inspect' ) ,
1498- withDockerJsonFormatArg ,
1502+ withDockerJsonFormatArg ( this . defaultFormatForJson ) ,
14991503 withArg ( ...options . networks ) ,
15001504 ) ( ) ;
15011505 }
0 commit comments