@@ -322,14 +322,15 @@ pub fn resource(subcommand: &ResourceSubCommand, stdin: &Option<String>) {
322
322
ResourceSubCommand :: List { resource_name, description, tags, format } => {
323
323
324
324
let mut write_table = false ;
325
- let mut table = Table :: new ( & [ "Type" , "Version" , "Requires" , "Description" ] ) ;
325
+ let mut methods: Vec < String > = Vec :: new ( ) ;
326
+ let mut table = Table :: new ( & [ "Type" , "Version" , "Methods" , "Requires" , "Description" ] ) ;
326
327
if format. is_none ( ) && atty:: is ( Stream :: Stdout ) {
327
- // write as table if fornat is not specified and interactive
328
+ // write as table if format is not specified and interactive
328
329
write_table = true ;
329
330
}
330
331
for resource in dsc. list_available_resources ( & resource_name. clone ( ) . unwrap_or_default ( ) ) {
331
- // if description is specified, skip if resource description does not contain it
332
- if description. is_some ( ) || tags. is_some ( ) {
332
+ // if description, tags, or write_table is specified, pull resource manifest if it exists
333
+ if description. is_some ( ) || tags. is_some ( ) || write_table {
333
334
let Some ( ref resource_manifest) = resource. manifest else {
334
335
continue ;
335
336
} ;
@@ -341,16 +342,15 @@ pub fn resource(subcommand: &ResourceSubCommand, stdin: &Option<String>) {
341
342
}
342
343
} ;
343
344
345
+ // if description is specified, skip if resource description does not contain it
344
346
if description. is_some ( ) &&
345
347
( manifest. description . is_none ( ) | !manifest. description . unwrap_or_default ( ) . to_lowercase ( ) . contains ( & description. as_ref ( ) . unwrap_or ( & String :: new ( ) ) . to_lowercase ( ) ) ) {
346
348
continue ;
347
349
}
348
350
349
351
// if tags is specified, skip if resource tags do not contain the tags
350
352
if let Some ( tags) = tags {
351
- let Some ( manifest_tags) = manifest. tags else {
352
- continue ;
353
- } ;
353
+ let Some ( manifest_tags) = manifest. tags else { continue ; } ;
354
354
355
355
let mut found = false ;
356
356
for tag_to_find in tags {
@@ -361,16 +361,20 @@ pub fn resource(subcommand: &ResourceSubCommand, stdin: &Option<String>) {
361
361
}
362
362
}
363
363
}
364
- if !found {
365
- continue ;
366
- }
364
+ if !found { continue ; }
367
365
}
366
+
367
+ methods = vec ! [ "get" . to_string( ) ] ;
368
+ if manifest. set . is_some ( ) { methods. push ( "set" . to_string ( ) ) ; }
369
+ if manifest. test . is_some ( ) { methods. push ( "test" . to_string ( ) ) ; }
370
+ if manifest. export . is_some ( ) { methods. push ( "export" . to_string ( ) ) ; }
368
371
}
369
372
370
373
if write_table {
371
374
table. add_row ( vec ! [
372
375
resource. type_name,
373
376
resource. version,
377
+ methods. join( ", " ) ,
374
378
resource. requires. unwrap_or_default( ) ,
375
379
resource. description. unwrap_or_default( )
376
380
] ) ;
@@ -386,9 +390,7 @@ pub fn resource(subcommand: &ResourceSubCommand, stdin: &Option<String>) {
386
390
} ;
387
391
write_output ( & json, format) ;
388
392
// insert newline separating instances if writing to console
389
- if atty:: is ( Stream :: Stdout ) {
390
- println ! ( ) ;
391
- }
393
+ if atty:: is ( Stream :: Stdout ) { println ! ( ) ; }
392
394
}
393
395
}
394
396
0 commit comments