[refactor] remove dialoguer dependency; migrate selection prompts to cliclack

This commit is contained in:
2025-08-12 04:12:53 +02:00
parent e954902aa9
commit df6faf6436
3 changed files with 5 additions and 52 deletions

40
Cargo.lock generated
View File

@@ -378,19 +378,6 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "dialoguer"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
dependencies = [
"console",
"shell-words",
"tempfile",
"thiserror",
"zeroize",
]
[[package]]
name = "digest"
version = "0.10.7"
@@ -1173,7 +1160,6 @@ dependencies = [
"clap_mangen",
"cliclack",
"ctrlc",
"dialoguer",
"indicatif",
"libc",
"reqwest",
@@ -1491,12 +1477,6 @@ dependencies = [
"digest",
]
[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]]
name = "shlex"
version = "1.3.0"
@@ -1625,26 +1605,6 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "thiserror"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tinystr"
version = "0.8.1"

View File

@@ -33,7 +33,6 @@ whisper-rs = { git = "https://github.com/tazz4843/whisper-rs", default-features
libc = "0.2"
indicatif = "0.17"
ctrlc = "3.4"
dialoguer = "0.11"
cliclack = "0.3"
[dev-dependencies]

View File

@@ -615,27 +615,21 @@ where
}
printer(&"Multiple Whisper models found:".to_string());
let mut display_names: Vec<String> = Vec::with_capacity(candidates.len());
for (i, p) in candidates.iter().enumerate() {
let name = p
.file_name()
.and_then(|s| s.to_str())
.map(|s| s.to_string())
.unwrap_or_else(|| p.display().to_string());
display_names.push(name.clone());
printer(&format!(" {}) {}", i + 1, name));
}
// Print a blank line and the selection prompt using the provided printer to
// keep output synchronized with any active progress rendering.
// Print a blank line before the selection prompt to keep output synchronized.
printer("");
let prompt = format!("Select model [1-{}]:", candidates.len());
// UI: using dialoguer::Input for selection for now; migration to cliclack::Select may be considered later for consistency.
let sel: usize = dialoguer::Input::new()
.with_prompt(prompt)
.interact_text()
let idx = crate::ui::prompt_select_index("Select a Whisper model", &display_names)
.context("Failed to read selection")?;
if sel == 0 || sel > candidates.len() {
return Err(anyhow!("Selection out of range"));
}
let chosen = candidates.swap_remove(sel - 1);
let chosen = candidates.swap_remove(idx);
let _ = std::fs::write(models_dir.join(".last_model"), chosen.display().to_string());
// Print an empty line after selection input
printer("");