mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
rm: fix prompt when --interactive is once
This commit is contained in:
+14
-5
@@ -115,11 +115,20 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
verbose: matches.get_flag(OPT_VERBOSE),
|
||||
};
|
||||
if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) {
|
||||
let msg = if options.recursive {
|
||||
"Remove all arguments recursively?"
|
||||
} else {
|
||||
"Remove all arguments?"
|
||||
};
|
||||
let msg: String = format!(
|
||||
"remove {} {}{}",
|
||||
files.len(),
|
||||
if files.len() > 1 {
|
||||
"arguments"
|
||||
} else {
|
||||
"argument"
|
||||
},
|
||||
if options.recursive {
|
||||
" recursively?"
|
||||
} else {
|
||||
"?"
|
||||
}
|
||||
);
|
||||
if !prompt_yes!("{}", msg) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user