From e50b84035fc54063e57dbc9e13757ae4986b8d22 Mon Sep 17 00:00:00 2001 From: John Shin Date: Mon, 22 May 2023 21:26:52 -0700 Subject: [PATCH] rm: fix prompt when --interactive is once --- src/uu/rm/src/rm.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 2d875bdd9..f2e2050d9 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -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(()); }