@@ -39,6 +39,9 @@ pub enum PluginCommands {
39
39
40
40
/// Fetch the latest Spin plugins from the spin-plugins repository.
41
41
Update ,
42
+
43
+ /// Print information about a plugin.
44
+ Show ( Show ) ,
42
45
}
43
46
44
47
impl PluginCommands {
@@ -50,6 +53,7 @@ impl PluginCommands {
50
53
PluginCommands :: Uninstall ( cmd) => cmd. run ( ) . await ,
51
54
PluginCommands :: Upgrade ( cmd) => cmd. run ( ) . await ,
52
55
PluginCommands :: Update => update ( ) . await ,
56
+ PluginCommands :: Show ( cmd) => cmd. run ( ) . await ,
53
57
}
54
58
}
55
59
}
@@ -416,6 +420,38 @@ impl Upgrade {
416
420
}
417
421
}
418
422
423
+ #[ derive( Parser , Debug ) ]
424
+ pub struct Show {
425
+ /// Name of Spin plugin.
426
+ pub name : String ,
427
+ }
428
+
429
+ impl Show {
430
+ pub async fn run ( self ) -> Result < ( ) > {
431
+ let manager = PluginManager :: try_default ( ) ?;
432
+ let manifest = manager
433
+ . get_manifest (
434
+ & ManifestLocation :: PluginsRepository ( PluginLookup :: new ( & self . name , None ) ) ,
435
+ false ,
436
+ SPIN_VERSION ,
437
+ )
438
+ . await ?;
439
+
440
+ println ! (
441
+ "{}: {} (License: {})\n {}\n {}" ,
442
+ manifest. name( ) ,
443
+ manifest. version( ) ,
444
+ manifest. license( ) ,
445
+ manifest
446
+ . homepage_url( )
447
+ . map( |u| format!( "{u}\n " ) )
448
+ . unwrap_or_default( ) ,
449
+ manifest. description( ) . unwrap_or( "No description provided" ) ,
450
+ ) ;
451
+ Ok ( ( ) )
452
+ }
453
+ }
454
+
419
455
fn is_potential_upgrade ( current : & PluginManifest , candidate : & PluginManifest ) -> bool {
420
456
match ( current. try_version ( ) , candidate. try_version ( ) ) {
421
457
( Ok ( cur_ver) , Ok ( cand_ver) ) => cand_ver > cur_ver,
0 commit comments