Remove executable alias; import anstream (#5187)

Post-push review from https://github.com/astral-sh/uv/pull/5160.
This commit is contained in:
Charlie Marsh 2024-07-18 10:09:29 -04:00 committed by GitHub
parent 8484611753
commit 36a0ee9822
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 5 deletions

View File

@ -2215,7 +2215,7 @@ pub struct ToolDirArgs {
/// ///
/// By default, `uv tool dir` shows the directory into which the tool Python environments /// By default, `uv tool dir` shows the directory into which the tool Python environments
/// themselves are installed, rather than the directory containing the linked executables. /// themselves are installed, rather than the directory containing the linked executables.
#[arg(long, alias = "executable")] #[arg(long)]
pub bin: bool, pub bin: bool,
} }

View File

@ -1,3 +1,4 @@
use anstream::println;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
use uv_cache::Cache; use uv_cache::Cache;
@ -5,5 +6,5 @@ use uv_fs::Simplified;
/// Show the cache directory. /// Show the cache directory.
pub(crate) fn cache_dir(cache: &Cache) { pub(crate) fn cache_dir(cache: &Cache) {
anstream::println!("{}", cache.root().simplified_display().cyan()); println!("{}", cache.root().simplified_display().cyan());
} }

View File

@ -1,3 +1,4 @@
use anstream::println;
use anyhow::Context; use anyhow::Context;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
@ -13,7 +14,7 @@ pub(crate) fn dir(preview: PreviewMode) -> anyhow::Result<()> {
} }
let installed_toolchains = ManagedPythonInstallations::from_settings() let installed_toolchains = ManagedPythonInstallations::from_settings()
.context("Failed to initialize toolchain settings")?; .context("Failed to initialize toolchain settings")?;
anstream::println!( println!(
"{}", "{}",
installed_toolchains.root().simplified_display().cyan() installed_toolchains.root().simplified_display().cyan()
); );

View File

@ -1,3 +1,4 @@
use anstream::println;
use anyhow::Context; use anyhow::Context;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
@ -14,11 +15,11 @@ pub(crate) fn dir(bin: bool, preview: PreviewMode) -> anyhow::Result<()> {
if bin { if bin {
let executable_directory = find_executable_directory()?; let executable_directory = find_executable_directory()?;
anstream::println!("{}", executable_directory.simplified_display().cyan()); println!("{}", executable_directory.simplified_display().cyan());
} else { } else {
let installed_tools = let installed_tools =
InstalledTools::from_settings().context("Failed to initialize tools settings")?; InstalledTools::from_settings().context("Failed to initialize tools settings")?;
anstream::println!("{}", installed_tools.root().simplified_display().cyan()); println!("{}", installed_tools.root().simplified_display().cyan());
} }
Ok(()) Ok(())