Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use non parsed version string to check if version is used #182

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/handlers/uninstall_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn start(version: Option<&str>, config: Config) -> Result<()> {
};

let version = helpers::version::parse_version_type(&client, version).await?;
if helpers::version::is_version_used(&version.tag_name, &config).await {
if helpers::version::is_version_used(&version.non_parsed_string, &config).await {
warn!("Switch to a different version before proceeding");
return Ok(());
}
Expand All @@ -32,10 +32,13 @@ pub async fn start(version: Option<&str>, config: Config) -> Result<()> {
Err(error) => return Err(anyhow!(error)),
};

let path = downloads_dir.join(&version.tag_name);
let path = downloads_dir.join(&version.non_parsed_string);

fs::remove_dir_all(path).await?;
info!("Successfully uninstalled version: {}", version.tag_name);
info!(
"Successfully uninstalled version: {}",
version.non_parsed_string
);
Ok(())
}

Expand All @@ -53,10 +56,10 @@ async fn uninstall_selections(client: &Client, config: &Config) -> Result<()> {
Err(_) => continue,
};

if helpers::version::is_version_used(&version.tag_name, config).await {
if helpers::version::is_version_used(&version.non_parsed_string, config).await {
continue;
}
installed_versions.push(version.tag_name);
installed_versions.push(version.non_parsed_string);
}

if installed_versions.is_empty() {
Expand Down
Loading