From 07c5547e49489718d738bf73d55fcccd8bd185f1 Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Sat, 17 Feb 2024 15:05:37 +0000 Subject: [PATCH] prompt user on windows before adding to HKEY_CURRENT_USER\Environment\Path --- rye/src/cli/rye.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rye/src/cli/rye.rs b/rye/src/cli/rye.rs index 908a4ab250..924af667f5 100644 --- a/rye/src/cli/rye.rs +++ b/rye/src/cli/rye.rs @@ -681,7 +681,18 @@ fn add_rye_to_path(mode: &InstallMode, shims: &Path, ask: bool) -> Result<(), Er #[cfg(windows)] { crate::utils::windows::add_to_programs(rye_home)?; - crate::utils::windows::add_to_path(rye_home)?; + + if matches!(mode, InstallMode::NoPrompts) + || !ask + || dialoguer::Confirm::with_theme(tui_theme()) + .with_prompt(format!( + "Should the installer add Rye to {}?", + style("HKEY_CURRENT_USER\\Environment\\PATH").cyan() + )) + .interact()? + { + crate::utils::windows::add_to_path(rye_home)?; + } } Ok(()) }