Skip to content

Commit

Permalink
Improve tool list output when tool environment is broken (#10409)
Browse files Browse the repository at this point in the history
## 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"
/>
  • Loading branch information
blueraft authored Jan 9, 2025
1 parent d77598a commit 452cafc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion crates/uv/src/commands/tool/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/it/tool_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
"###
);

Expand Down

0 comments on commit 452cafc

Please sign in to comment.