mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
rm: fix prompt when --interactive is once
This commit is contained in:
parent
eeb3341101
commit
e50b84035f
1 changed files with 14 additions and 5 deletions
|
@ -115,11 +115,20 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
verbose: matches.get_flag(OPT_VERBOSE),
|
verbose: matches.get_flag(OPT_VERBOSE),
|
||||||
};
|
};
|
||||||
if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) {
|
if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) {
|
||||||
let msg = if options.recursive {
|
let msg: String = format!(
|
||||||
"Remove all arguments recursively?"
|
"remove {} {}{}",
|
||||||
|
files.len(),
|
||||||
|
if files.len() > 1 {
|
||||||
|
"arguments"
|
||||||
} else {
|
} else {
|
||||||
"Remove all arguments?"
|
"argument"
|
||||||
};
|
},
|
||||||
|
if options.recursive {
|
||||||
|
" recursively?"
|
||||||
|
} else {
|
||||||
|
"?"
|
||||||
|
}
|
||||||
|
);
|
||||||
if !prompt_yes!("{}", msg) {
|
if !prompt_yes!("{}", msg) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue