Skip to content

Commit

Permalink
fix: use tv.short in mise prune
Browse files Browse the repository at this point in the history
Fixes #2870
  • Loading branch information
jdx committed Nov 26, 2024
1 parent b200169 commit 4bc4f0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/cli/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ use std::sync::Arc;

use console::style;
use eyre::Result;

use crate::backend::Backend;
use crate::cli::args::BackendArg;
use crate::config::tracking::Tracker;
use crate::config::{Config, Settings};
use crate::config::{Config, SETTINGS};
use crate::toolset::{ToolVersion, Toolset, ToolsetBuilder};
use crate::ui::multi_progress_report::MultiProgressReport;
use crate::ui::prompt;
Expand Down Expand Up @@ -87,15 +86,17 @@ impl Prune {
}

fn delete(&self, to_delete: Vec<(Arc<dyn Backend>, ToolVersion)>) -> Result<()> {
let settings = Settings::try_get()?;
let mpr = MultiProgressReport::get();
for (p, tv) in to_delete {
let mut prefix = tv.style();
if self.dry_run {
prefix = format!("{} {} ", prefix, style("[dryrun]").bold());
}
let pr = mpr.add(&prefix);
if self.dry_run || settings.yes || prompt::confirm(format!("remove {} ?", &tv))? {
if self.dry_run
|| SETTINGS.yes
|| prompt::confirm_with_all(format!("remove {} ?", &tv))?
{
p.uninstall_version(&tv, pr.as_ref(), self.dry_run)?;
pr.finish();
}
Expand Down
3 changes: 2 additions & 1 deletion src/toolset/tool_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::hash::hash_to_str;
use crate::toolset::{tool_request, ToolRequest, ToolVersionOptions};
use console::style;
use eyre::Result;
use heck::ToKebabCase;
#[cfg(windows)]
use path_absolutize::Absolutize;

Expand Down Expand Up @@ -268,7 +269,7 @@ impl ToolVersion {

impl Display for ToolVersion {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
write!(f, "{}@{}", &self.ba().full(), &self.version)
write!(f, "{}@{}", &self.ba().full(), &self.version.to_kebab_case())
}
}

Expand Down

0 comments on commit 4bc4f0d

Please sign in to comment.