1- use std:: fmt:: { self , Display } ;
21use std:: error:: Error ;
2+ use std:: fmt:: { self , Display } ;
33use std:: io:: { self , Read , Write } ;
44
55use ascii_table:: { Align , AsciiTable } ;
@@ -29,7 +29,7 @@ impl Display for InspectDisplay {
2929 Self :: Table => write ! ( f, "table" ) ,
3030 Self :: Json => write ! ( f, "json" ) ,
3131 Self :: None => write ! ( f, "none" ) ,
32- }
32+ }
3333 }
3434}
3535
@@ -98,10 +98,10 @@ impl Displayable for registry::Collection {
9898 fn display_table ( & self ) {
9999 let mut table = AsciiTable :: default ( ) ;
100100 let data = [
101- [ "Name" , self . source_information . name . as_ref ( ) ] ,
102- [ "Maintainer" , self . source_information . maintainer . as_ref ( ) ] ,
103- [ "Contact" , self . source_information . contact . as_ref ( ) ] ,
104- [ "Repository" , self . source_information . repository . as_ref ( ) ] ,
101+ [ "Name" , self . source_information . name . as_ref ( ) ] ,
102+ [ "Maintainer" , self . source_information . maintainer . as_ref ( ) ] ,
103+ [ "Contact" , self . source_information . contact . as_ref ( ) ] ,
104+ [ "Repository" , self . source_information . repository . as_ref ( ) ] ,
105105 [ "OCI Reference" , self . source_information . oci_reference . as_ref ( ) ] ,
106106 ] ;
107107
@@ -123,24 +123,31 @@ impl Displayable for registry::Feature {
123123 data. maybe_push ( "Documentation URL" , self . documentation_url . as_ref ( ) ) ;
124124 data. maybe_push ( "License URL" , self . license_url . as_ref ( ) ) ;
125125 data. maybe_push ( "Keywords" , self . keywords . as_ref ( ) . map ( comma_join) ) ;
126- data. many_push ( "Options" , self . options . as_ref ( ) . map ( |options| {
127- options. iter ( )
128- . map ( |( key, value) | format ! ( "name={key}, {value}" ) )
129- . collect :: < Vec < String > > ( )
130- } ) ) ;
131- data. many_push ( "Container ENV" , self . container_env . as_ref ( ) . map ( |container_env| {
132- container_env. iter ( )
133- . map ( |( key, value) | format ! ( "{key}={value}" ) )
134- . collect :: < Vec < String > > ( )
135- } ) ) ;
126+ data. many_push (
127+ "Options" ,
128+ self . options . as_ref ( ) . map ( |options| {
129+ options
130+ . iter ( )
131+ . map ( |( key, value) | format ! ( "name={key}, {value}" ) )
132+ . collect :: < Vec < String > > ( )
133+ } ) ,
134+ ) ;
135+ data. many_push (
136+ "Container ENV" ,
137+ self . container_env . as_ref ( ) . map ( |container_env| {
138+ container_env
139+ . iter ( )
140+ . map ( |( key, value) | format ! ( "{key}={value}" ) )
141+ . collect :: < Vec < String > > ( )
142+ } ) ,
143+ ) ;
136144 data. maybe_push ( "Privileged" , self . privileged ) ;
137145 data. maybe_push ( "Init" , self . init ) ;
138146 data. maybe_push ( "Cap Add" , self . cap_add . as_ref ( ) . map ( comma_join) ) ;
139147 data. maybe_push ( "Security Opt" , self . security_opt . as_ref ( ) . map ( comma_join) ) ;
140148 data. maybe_push ( "Entrypoint" , self . entrypoint . as_ref ( ) ) ;
141149
142- let vscode_extensions =
143- self . customizations . as_ref ( )
150+ let vscode_extensions = ( self . customizations . as_ref ( ) )
144151 . and_then ( |customizations| customizations. vscode_extensions ( ) )
145152 . as_ref ( )
146153 . map ( comma_join) ;
@@ -176,11 +183,15 @@ impl Displayable for registry::Template {
176183 data. maybe_push ( "Description" , self . description . as_ref ( ) ) ;
177184 data. maybe_push ( "Documentation URL" , self . documentation_url . as_ref ( ) ) ;
178185 data. maybe_push ( "License URL" , self . license_url . as_ref ( ) ) ;
179- data. many_push ( "Options" , self . options . as_ref ( ) . map ( |options| {
180- options. iter ( )
181- . map ( |( key, value) | format ! ( "name={key}, {value}" ) )
182- . collect :: < Vec < String > > ( )
183- } ) ) ;
186+ data. many_push (
187+ "Options" ,
188+ self . options . as_ref ( ) . map ( |options| {
189+ options
190+ . iter ( )
191+ . map ( |( key, value) | format ! ( "name={key}, {value}" ) )
192+ . collect :: < Vec < String > > ( )
193+ } ) ,
194+ ) ;
184195 data. maybe_push ( "Platforms" , self . platforms . as_ref ( ) . map ( comma_join) ) ;
185196 data. maybe_push ( "Publisher" , self . publisher . as_ref ( ) ) ;
186197 data. maybe_push ( "Keywords" , self . keywords . as_ref ( ) . map ( comma_join) ) ;
@@ -252,7 +263,10 @@ fn display_install_sh(oci_ref: &OciReference) -> Result<(), Box<dyn Error>> {
252263 }
253264 }
254265
255- Err ( io:: Error :: new ( io:: ErrorKind :: NotFound , "The install.sh script was not found in the archive" ) ) ?
266+ Err ( io:: Error :: new (
267+ io:: ErrorKind :: NotFound ,
268+ "The install.sh script was not found in the archive" ,
269+ ) ) ?
256270}
257271
258272pub fn inspect (
@@ -262,7 +276,7 @@ pub fn inspect(
262276 display_as,
263277 install_sh,
264278 show_files,
265- } : InspectArgs
279+ } : InspectArgs ,
266280) -> Result < ( ) , Box < dyn Error > > {
267281 log:: debug!( "inspect" ) ;
268282
@@ -311,7 +325,10 @@ pub fn inspect(
311325 Ok ( ( ) )
312326 } ,
313327 ( None , None , None ) => Err ( io:: Error :: new ( io:: ErrorKind :: NotFound , "No match found for given id." ) ) ,
314- _ => Err ( io:: Error :: new ( io:: ErrorKind :: Unsupported , "Multiple results found for given id." ) ) ,
328+ _ => Err ( io:: Error :: new (
329+ io:: ErrorKind :: Unsupported ,
330+ "Multiple results found for given id." ,
331+ ) ) ,
315332 } ?;
316333
317334 log:: debug!( "inspect: done" ) ;
0 commit comments