From 9643fb99d122f6060679199fbb0e3c375578bce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ca=C3=ADque=20Porfirio?= <56317416+caiquejjx@users.noreply.github.com> Date: Thu, 11 Jul 2024 22:06:54 -0300 Subject: [PATCH] Rename `python install --force` parameter to `--reinstall` (#4999) ## Summary Rename the `--force` parameter of `uv python install` to `--reinstall`. Closes #4961. --- crates/uv-cli/src/lib.rs | 6 +++--- crates/uv/src/commands/python/install.rs | 4 ++-- crates/uv/src/lib.rs | 2 +- crates/uv/src/settings.rs | 6 +++--- crates/uv/tests/help.rs | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index c687b0bd8..a1e65bbc9 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -2205,9 +2205,9 @@ pub struct PythonInstallArgs { /// installed any Python versions. If not, it will install the latest stable version of Python. pub targets: Vec, - /// Force the installation of the requested Python, even if it is already installed. - #[arg(long, short)] - pub force: bool, + /// Reinstall the requested Python version, if it's already installed. + #[arg(long, short, alias = "force")] + pub reinstall: bool, } #[derive(Args)] diff --git a/crates/uv/src/commands/python/install.rs b/crates/uv/src/commands/python/install.rs index 26519a97f..eab059549 100644 --- a/crates/uv/src/commands/python/install.rs +++ b/crates/uv/src/commands/python/install.rs @@ -26,7 +26,7 @@ use crate::printer::Printer; /// Download and install Python versions. pub(crate) async fn install( targets: Vec, - force: bool, + reinstall: bool, native_tls: bool, connectivity: Connectivity, preview: PreviewMode, @@ -96,7 +96,7 @@ pub(crate) async fn install( installation.key().green(), )?; } - if force { + if reinstall { writeln!( printer.stderr(), "Uninstalling {}", diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index cd00d67e4..714b41e7d 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -712,7 +712,7 @@ async fn run(cli: Cli) -> Result { commands::python_install( args.targets, - args.force, + args.reinstall, globals.native_tls, globals.connectivity, globals.preview, diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index c4a8663ad..b61186d64 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -359,16 +359,16 @@ impl PythonListSettings { #[derive(Debug, Clone)] pub(crate) struct PythonInstallSettings { pub(crate) targets: Vec, - pub(crate) force: bool, + pub(crate) reinstall: bool, } impl PythonInstallSettings { /// Resolve the [`PythonInstallSettings`] from the CLI and filesystem configuration. #[allow(clippy::needless_pass_by_value)] pub(crate) fn resolve(args: PythonInstallArgs, _filesystem: Option) -> Self { - let PythonInstallArgs { targets, force } = args; + let PythonInstallArgs { targets, reinstall } = args; - Self { targets, force } + Self { targets, reinstall } } } diff --git a/crates/uv/tests/help.rs b/crates/uv/tests/help.rs index efef3a753..1b43cb9d6 100644 --- a/crates/uv/tests/help.rs +++ b/crates/uv/tests/help.rs @@ -301,8 +301,8 @@ fn help_subsubcommand() { any Python versions. If not, it will install the latest stable version of Python. Options: - -f, --force - Force the installation of the requested Python, even if it is already installed + -r, --reinstall + Reinstall the requested Python version, if it's already installed -q, --quiet Do not print any output @@ -462,8 +462,8 @@ fn help_flag_subsubcommand() { [TARGETS]... The Python version(s) to install Options: - -f, --force - Force the installation of the requested Python, even if it is already installed + -r, --reinstall + Reinstall the requested Python version, if it's already installed -q, --quiet Do not print any output -v, --verbose...