1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-07 16:37:48 +00:00

Fixed invert issue

This commit is contained in:
Pat Laster 2022-10-16 13:14:17 -05:00
parent b612ce5cd7
commit 03578a7aca

View file

@ -91,11 +91,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let force_prompt_never: bool = force_flag && { let force_prompt_never: bool = force_flag && {
if matches.value_source(OPT_FORCE) == Some(ValueSource::CommandLine) { if matches.value_source(OPT_FORCE) == Some(ValueSource::CommandLine) {
let force_index = matches.index_of(OPT_FORCE).unwrap_or(0); 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() .iter()
.any(|opt| { .any(|flag| {
matches.value_source(opt) == Some(ValueSource::CommandLine) matches.value_source(flag) == Some(ValueSource::CommandLine)
&& matches.index_of(opt).unwrap_or(0) < force_index && matches.index_of(flag).unwrap_or(0) > force_index
}) })
} else { } else {
false false
@ -110,7 +110,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let options = Options { let options = Options {
force: force_flag, force: force_flag,
interactive: { interactive: {
if force_flag && force_prompt_never { if force_prompt_never {
InteractiveMode::Never InteractiveMode::Never
} else if matches.get_flag(OPT_PROMPT) { } else if matches.get_flag(OPT_PROMPT) {
InteractiveMode::Always InteractiveMode::Always