Skip to content

Commit

Permalink
fix: go backend naming inconsistency (in mise ls and mise prune) (#1905)
Browse files Browse the repository at this point in the history
  • Loading branch information
roele authored Apr 15, 2024
1 parent 6c96bc6 commit 35e8054
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/cli/args/forge_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ impl ForgeArg {
}

pub fn from_pathname(name: &str) -> Self {
let fa_name = name.replacen('-', ":", 1);
let mut fa_name = name.replacen('-', ":", 1);
let forge_type = name.split('-').next().unwrap_or_default();
// Go packages cannot have dashes in their name.
// - Simply replace dashes with slashes
if ForgeType::Go.as_ref() == forge_type {
fa_name = fa_name.replace('-', "/");
}
// NPM packages can have dashes and slashes in their name.
// - If scoped, replace first dash after the @ with a slash. Will not work for scopes using dashes
if ForgeType::Npm.as_ref() == forge_type && fa_name.contains('@') {
fa_name = fa_name.replacen('-', "/", 1);
}
ForgeArg::from_str(&fa_name).unwrap()
}
}
Expand Down

0 comments on commit 35e8054

Please sign in to comment.