Skip to content

Commit

Permalink
Merge pull request #1563 from kate-goldenring/plugin-list-desired-spin
Browse files Browse the repository at this point in the history
fix(plugins): Display required Spin version of incompatible plugins
  • Loading branch information
kate-goldenring authored Jun 8, 2023
2 parents 9bbd2db + 4715094 commit 414a285
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions crates/plugins/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ impl PluginManifest {
self.license.as_ref()
}

pub fn spin_compatibility(&self) -> String {
self.spin_compatibility.clone()
}

pub fn description(&self) -> Option<&str> {
self.description.as_deref()
}
Expand Down
12 changes: 6 additions & 6 deletions src/commands/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ impl List {
} else {
for p in plugins {
let installed = if p.installed { " [installed]" } else { "" };
let compat = match p.compatibility {
PluginCompatibility::Compatible => "",
PluginCompatibility::IncompatibleSpin => " [requires other Spin version]",
PluginCompatibility::Incompatible => " [incompatible]",
let compat = match &p.compatibility {
PluginCompatibility::Compatible => String::new(),
PluginCompatibility::IncompatibleSpin(v) => format!(" [requires Spin {v}]"),
PluginCompatibility::Incompatible => String::from(" [incompatible]"),
};
println!("{} {}{}{}", p.name, p.version, installed, compat);
}
Expand All @@ -367,7 +367,7 @@ impl List {
#[derive(Debug)]
pub(crate) enum PluginCompatibility {
Compatible,
IncompatibleSpin,
IncompatibleSpin(String),
Incompatible,
}

Expand All @@ -378,7 +378,7 @@ impl PluginCompatibility {
if manifest.is_compatible_spin_version(spin_version) {
Self::Compatible
} else {
Self::IncompatibleSpin
Self::IncompatibleSpin(manifest.spin_compatibility())
}
} else {
Self::Incompatible
Expand Down

0 comments on commit 414a285

Please sign in to comment.