coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] rm: Add number of arguments to interactive prompt


From: Pádraig Brady
Subject: Re: [PATCH] rm: Add number of arguments to interactive prompt
Date: Fri, 19 Jul 2013 11:40:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 07/19/2013 12:53 AM, Pádraig Brady wrote:
> On 07/18/2013 10:53 PM, Rasmus Villemoes wrote:
>> Include the number of arguments which rm received in the "Remove all
>> arguments?" prompt. This is useful in the, presumably, common case
>> where the arguments were not provided by hand, but instead were the
>> result of various shell expansions. A simple, if somewhat contrived,
>> example (assuming rm is aliased to rm -I) could be
>>
>>   rm * .o
>>
>> where the prompt "Remove all 120 arguments?" is more likely to make
>> the user catch the problem.
> 
> This makes sense.
> Though slightly awkward when n_file==1 it's an improvement.
>  I'll apply soon.

I've adjusted to correctly pluralize and remove the redudant "all".
thanks,
Pádraig.

commit a6182978d570c65d7d89dd8306e15fe6fb59dfee
Author: Rasmus Villemoes <address@hidden>
Date:   Thu Jul 18 21:53:12 2013 +0000

    rm: output number of arguments at the interactive prompt

    Include the number of arguments which rm received in the "Remove all
    arguments?" prompt.  This is useful in the, presumably, common case
    where the arguments were not provided by hand, but instead were the
    result of various shell expansions.  A simple, if somewhat contrived,
    example (assuming rm is aliased to rm -I) could be:

      rm * .o

    where the prompt "Remove all 120 arguments?" is more likely to make
    the user catch the problem.

    * src/rm.c (main): Include correctly pluralized n_files
    in the output message.  Also remove the now redudant "all".

diff --git a/src/rm.c b/src/rm.c
index 3e187cf..b9b84e1 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -339,9 +339,13 @@ main (int argc, char **argv)
     {
       fprintf (stderr,
                (x.recursive
-                ? _("%s: remove all arguments recursively? ")
-                : _("%s: remove all arguments? ")),
-               program_name);
+                ? ngettext ("%s: remove %zu argument recursively? ",
+                            "%s: remove %zu arguments recursively? ",
+                            select_plural (n_files))
+                : ngettext ("%s: remove %zu argument? ",
+                            "%s: remove %zu arguments? ",
+                            select_plural (n_files))),
+               program_name, n_files);
       if (!yesno ())
         exit (EXIT_SUCCESS);
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]