Improve tool list output when tool environment is broken (#10409)
## Summary Closes #9579 ## Test Plan `cargo test` <img width="1110" alt="Screenshot 2025-01-08 at 21 13 11" src="https://github.com/user-attachments/assets/8937c14e-c594-470f-a8f2-77ac7167794f" />
This commit is contained in:
@@ -51,7 +51,14 @@ pub(crate) async fn list(
|
||||
let version = match installed_tools.version(&name, cache) {
|
||||
Ok(version) => version,
|
||||
Err(e) => {
|
||||
writeln!(printer.stderr(), "{e}")?;
|
||||
if let uv_tool::Error::EnvironmentError(e) = e {
|
||||
warn_user!(
|
||||
"{e} (run `{}` to reinstall)",
|
||||
format!("uv tool install {name} --reinstall").green()
|
||||
);
|
||||
} else {
|
||||
writeln!(printer.stderr(), "{e}")?;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -156,7 +156,7 @@ fn tool_list_bad_environment() -> Result<()> {
|
||||
- ruff
|
||||
|
||||
----- stderr -----
|
||||
Invalid environment at `tools/black`: missing Python executable at `tools/black/[BIN]/python`
|
||||
warning: Invalid environment at `tools/black`: missing Python executable at `tools/black/[BIN]/python` (run `uv tool install black --reinstall` to reinstall)
|
||||
"###
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user