Rename python install --force parameter to --reinstall (#4999)

## Summary

Rename the `--force` parameter of `uv python install` to `--reinstall`.

Closes #4961.
This commit is contained in:
Caíque Porfirio 2024-07-11 22:06:54 -03:00 committed by GitHub
parent c345484c93
commit 9643fb99d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 13 deletions

View file

@ -2205,9 +2205,9 @@ pub struct PythonInstallArgs {
/// installed any Python versions. If not, it will install the latest stable version of Python. /// installed any Python versions. If not, it will install the latest stable version of Python.
pub targets: Vec<String>, pub targets: Vec<String>,
/// Force the installation of the requested Python, even if it is already installed. /// Reinstall the requested Python version, if it's already installed.
#[arg(long, short)] #[arg(long, short, alias = "force")]
pub force: bool, pub reinstall: bool,
} }
#[derive(Args)] #[derive(Args)]

View file

@ -26,7 +26,7 @@ use crate::printer::Printer;
/// Download and install Python versions. /// Download and install Python versions.
pub(crate) async fn install( pub(crate) async fn install(
targets: Vec<String>, targets: Vec<String>,
force: bool, reinstall: bool,
native_tls: bool, native_tls: bool,
connectivity: Connectivity, connectivity: Connectivity,
preview: PreviewMode, preview: PreviewMode,
@ -96,7 +96,7 @@ pub(crate) async fn install(
installation.key().green(), installation.key().green(),
)?; )?;
} }
if force { if reinstall {
writeln!( writeln!(
printer.stderr(), printer.stderr(),
"Uninstalling {}", "Uninstalling {}",

View file

@ -712,7 +712,7 @@ async fn run(cli: Cli) -> Result<ExitStatus> {
commands::python_install( commands::python_install(
args.targets, args.targets,
args.force, args.reinstall,
globals.native_tls, globals.native_tls,
globals.connectivity, globals.connectivity,
globals.preview, globals.preview,

View file

@ -359,16 +359,16 @@ impl PythonListSettings {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct PythonInstallSettings { pub(crate) struct PythonInstallSettings {
pub(crate) targets: Vec<String>, pub(crate) targets: Vec<String>,
pub(crate) force: bool, pub(crate) reinstall: bool,
} }
impl PythonInstallSettings { impl PythonInstallSettings {
/// Resolve the [`PythonInstallSettings`] from the CLI and filesystem configuration. /// Resolve the [`PythonInstallSettings`] from the CLI and filesystem configuration.
#[allow(clippy::needless_pass_by_value)] #[allow(clippy::needless_pass_by_value)]
pub(crate) fn resolve(args: PythonInstallArgs, _filesystem: Option<FilesystemOptions>) -> Self { pub(crate) fn resolve(args: PythonInstallArgs, _filesystem: Option<FilesystemOptions>) -> Self {
let PythonInstallArgs { targets, force } = args; let PythonInstallArgs { targets, reinstall } = args;
Self { targets, force } Self { targets, reinstall }
} }
} }

View file

@ -301,8 +301,8 @@ fn help_subsubcommand() {
any Python versions. If not, it will install the latest stable version of Python. any Python versions. If not, it will install the latest stable version of Python.
Options: Options:
-f, --force -r, --reinstall
Force the installation of the requested Python, even if it is already installed Reinstall the requested Python version, if it's already installed
-q, --quiet -q, --quiet
Do not print any output Do not print any output
@ -462,8 +462,8 @@ fn help_flag_subsubcommand() {
[TARGETS]... The Python version(s) to install [TARGETS]... The Python version(s) to install
Options: Options:
-f, --force -r, --reinstall
Force the installation of the requested Python, even if it is already installed Reinstall the requested Python version, if it's already installed
-q, --quiet -q, --quiet
Do not print any output Do not print any output
-v, --verbose... -v, --verbose...