diff --git a/Cargo.lock b/Cargo.lock index 2fe331d..e79fcae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1468,7 +1468,7 @@ checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" [[package]] name = "libium" version = "1.32.0" -source = "git+https://github.com/gorilla-devs/libium?rev=e043a6e17a475158a595cfcf1767ef81521d0587#e043a6e17a475158a595cfcf1767ef81521d0587" +source = "git+https://github.com/gorilla-devs/libium?rev=425a043553f42e2872a70f193cd5042effce561a#425a043553f42e2872a70f193cd5042effce561a" dependencies = [ "clap", "derive_more", diff --git a/Cargo.toml b/Cargo.toml index 5a4f0f8..b4ebfb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ fs_extra = "1.3" ferinth = "2.11" colored = "3.0" inquire = "0.7" -libium = { git = "https://github.com/gorilla-devs/libium", rev = "e043a6e17a475158a595cfcf1767ef81521d0587" } +libium = { git = "https://github.com/gorilla-devs/libium", rev = "425a043553f42e2872a70f193cd5042effce561a" } # libium = { path = "../libium" } # libium = "1.32" anyhow = "1.0" diff --git a/src/subcommands/list.rs b/src/subcommands/list.rs index e1c90f6..eed7f01 100644 --- a/src/subcommands/list.rs +++ b/src/subcommands/list.rs @@ -14,7 +14,7 @@ use tokio::task::JoinSet; enum Metadata { CF(Mod), MD(Project, Vec), - GH(Repository, Vec), + GH(Box, Vec), } impl Metadata { fn name(&self) -> &str { @@ -35,6 +35,14 @@ impl Metadata { } } } + + fn slug(&self) -> &str { + match self { + Metadata::CF(p) => &p.slug, + Metadata::MD(p, _) => &p.slug, + Metadata::GH(p, _) => &p.name, + } + } } pub async fn verbose(profile: &mut Profile, markdown: bool) -> Result<()> { @@ -92,7 +100,7 @@ pub async fn verbose(profile: &mut Profile, markdown: bool) -> Result<()> { } for res in tasks.join_all().await { let (repo, releases) = res?; - metadata.push(Metadata::GH(repo, releases.items)); + metadata.push(Metadata::GH(Box::new(repo), releases.items)); } metadata.sort_unstable_by_key(|e| e.name().to_lowercase()); @@ -101,12 +109,14 @@ pub async fn verbose(profile: &mut Profile, markdown: bool) -> Result<()> { } for project in &metadata { - profile + let mod_ = profile .mods .iter_mut() .find(|mod_| mod_.identifier == project.id()) - .context("Could not find expected mod")? - .name = project.name().to_string(); + .context("Could not find expected mod")?; + + mod_.name = project.name().to_string(); + mod_.slug = Some(project.slug().to_string()); if markdown { match project { diff --git a/src/subcommands/remove.rs b/src/subcommands/remove.rs index ca17770..3d075bf 100644 --- a/src/subcommands/remove.rs +++ b/src/subcommands/remove.rs @@ -51,6 +51,10 @@ pub fn remove(profile: &mut Profile, to_remove: Vec) -> Result<()> { } _ => todo!(), } + || match &mod_.slug { + Some(slug) => to_remove.eq_ignore_ascii_case(slug), + None => false, + } }) { items_to_remove.push(index); } else {