mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Show fully-resolved URLs in non-resolution contexts (#689)
We now show the fully-resolved URL, rather than the URL as given by the user, _everywhere_ except for the output resolution file (which should retain relative paths, unexpanded environment variables, etc.). Closes https://github.com/astral-sh/puffin/issues/687.
This commit is contained in:
parent
43c837f7bb
commit
365c860e27
10 changed files with 123 additions and 39 deletions
|
@ -37,6 +37,11 @@ impl VerbatimUrl {
|
|||
})
|
||||
}
|
||||
|
||||
/// Return the original string as given by the user, if available.
|
||||
pub fn given(&self) -> Option<&str> {
|
||||
self.given.as_deref()
|
||||
}
|
||||
|
||||
/// Return the underlying [`Url`].
|
||||
pub fn raw(&self) -> &Url {
|
||||
&self.url
|
||||
|
@ -66,11 +71,7 @@ impl std::str::FromStr for VerbatimUrl {
|
|||
|
||||
impl std::fmt::Display for VerbatimUrl {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if let Some(given) = &self.given {
|
||||
given.fmt(f)
|
||||
} else {
|
||||
self.url.fmt(f)
|
||||
}
|
||||
self.url.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue