From 66ef5cfe909ac0e346479f43e00846f9ba23d9d9 Mon Sep 17 00:00:00 2001 From: Brett Earle Date: Sat, 17 Feb 2024 12:06:56 +1030 Subject: [PATCH] fix ambiguous prompt after setting up custom installation --- src/cli/common.rs | 11 ++++++----- src/cli/self_update.rs | 5 +++-- tests/suite/cli_inst_interactive.rs | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index 20cbe7d1e1..f74e70b943 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -56,12 +56,13 @@ pub(crate) enum Confirm { Advanced, } -pub(crate) fn confirm_advanced() -> Result { +pub(crate) fn confirm_advanced(customized_install: bool) -> Result { writeln!(process().stdout().lock())?; - writeln!( - process().stdout().lock(), - "1) Proceed with installation (default)" - )?; + let first_option = match customized_install { + true => "1) Proceed with selected options (default - just press enter)", + false => "1) Proceed with standard installation (default - just press enter)", + }; + writeln!(process().stdout().lock(), "{first_option}")?; writeln!(process().stdout().lock(), "2) Customize installation")?; writeln!(process().stdout().lock(), "3) Cancel installation")?; write!(process().stdout().lock(), ">")?; diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 5b0709e758..53f91e5ba2 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -433,10 +433,10 @@ pub(crate) fn install( let msg = pre_install_msg(opts.no_modify_path)?; md(&mut term, msg); - + let mut customized_install = false; loop { md(&mut term, current_install_opts(&opts)); - match common::confirm_advanced()? { + match common::confirm_advanced(customized_install)? { Confirm::No => { info!("aborting installation"); return Ok(utils::ExitCode(0)); @@ -445,6 +445,7 @@ pub(crate) fn install( break; } Confirm::Advanced => { + customized_install = true; opts = customize_install(opts)?; } } diff --git a/tests/suite/cli_inst_interactive.rs b/tests/suite/cli_inst_interactive.rs index 0a0bd5a26f..66b72f7e0e 100644 --- a/tests/suite/cli_inst_interactive.rs +++ b/tests/suite/cli_inst_interactive.rs @@ -90,7 +90,7 @@ Current installation options: profile: default modify PATH variable: no -1) Proceed with installation (default) +1) Proceed with standard installation (default - just press enter) 2) Customize installation 3) Cancel installation >