mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-27 18:36:44 +00:00
Use upgrade-specific output for tool upgrade (#5997)
## Summary Closes https://github.com/astral-sh/uv/issues/5949.
This commit is contained in:
parent
f5110f7b5e
commit
ec8248ff93
6 changed files with 222 additions and 76 deletions
|
|
@ -124,6 +124,24 @@ pub enum InstalledVersion<'a> {
|
|||
Url(&'a Url, &'a Version),
|
||||
}
|
||||
|
||||
impl<'a> InstalledVersion<'a> {
|
||||
/// If it is a URL, return its value.
|
||||
pub fn url(&self) -> Option<&Url> {
|
||||
match self {
|
||||
InstalledVersion::Version(_) => None,
|
||||
InstalledVersion::Url(url, _) => Some(url),
|
||||
}
|
||||
}
|
||||
|
||||
/// If it is a version, return its value.
|
||||
pub fn version(&self) -> &Version {
|
||||
match self {
|
||||
InstalledVersion::Version(version) => version,
|
||||
InstalledVersion::Url(_, version) => version,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for InstalledVersion<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue