From 03578a7acae1c9434508c13a4a3ccd16bab82f46 Mon Sep 17 00:00:00 2001 From: Pat Laster Date: Sun, 16 Oct 2022 13:14:17 -0500 Subject: [PATCH] Fixed invert issue --- src/uu/rm/src/rm.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 190298aa6..93f99eea3 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -91,11 +91,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let force_prompt_never: bool = force_flag && { if matches.value_source(OPT_FORCE) == Some(ValueSource::CommandLine) { let force_index = matches.index_of(OPT_FORCE).unwrap_or(0); - [OPT_PROMPT, OPT_PROMPT_MORE, OPT_INTERACTIVE] + ![OPT_PROMPT, OPT_PROMPT_MORE, OPT_INTERACTIVE] .iter() - .any(|opt| { - matches.value_source(opt) == Some(ValueSource::CommandLine) - && matches.index_of(opt).unwrap_or(0) < force_index + .any(|flag| { + matches.value_source(flag) == Some(ValueSource::CommandLine) + && matches.index_of(flag).unwrap_or(0) > force_index }) } else { false @@ -110,7 +110,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let options = Options { force: force_flag, interactive: { - if force_flag && force_prompt_never { + if force_prompt_never { InteractiveMode::Never } else if matches.get_flag(OPT_PROMPT) { InteractiveMode::Always