Improve output when an older toolchain version is already installed (#4248)

e.g.

```
❯ uv toolchain install
Found installed toolchain 'cpython-3.9.19-macos-aarch64-none'
A toolchain is already installed. Use `uv toolchain install <request>` to install a specific toolchain
```

instead of

```
❯ uv toolchain install
Using latest Python version
Found installed toolchain 'cpython-3.9.19-macos-aarch64-none'
Already installed at /Users/zb/Library/Application Support/uv/toolchains/cpython-3.9.19-macos-aarch64-none
```
This commit is contained in:
Zanie Blue 2024-06-11 15:49:15 -04:00 committed by GitHub
parent dce913c542
commit 8cfe202e4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 6 deletions

View File

@ -45,7 +45,6 @@ pub(crate) async fn install(
}
request
} else {
writeln!(printer.stderr(), "Using latest Python version")?;
ToolchainRequest::default()
};
@ -58,11 +57,19 @@ pub(crate) async fn install(
"Found installed toolchain '{}'",
toolchain.key()
)?;
if matches!(request, ToolchainRequest::Any) {
writeln!(
printer.stderr(),
"A toolchain is already installed. Use `uv toolchain install <request>` to install a specific toolchain.",
)?;
} else {
writeln!(
printer.stderr(),
"Already installed at {}",
toolchain.path().user_display()
)?;
}
return Ok(ExitStatus::Success);
}