coreutils
[Top][All Lists]
Advanced

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

Simpler name for --no-clobber option


From: Tomas Zubiri
Subject: Simpler name for --no-clobber option
Date: Wed, 11 Mar 2020 07:08:18 -0300

Hello,
I'm attaching a git patch for a small, easy improvement that would
make cp easier and more pleasant to use and learn.

 cp overwrites files by default, this can be disabled by using the
command line option --no-clobber, the proposal is merely to introduce
an alias called --no-overwrites.

Please let me know if somebody would be willing to merge this in
principle so we can move address fine details like testing and the
technical approach used.

For convenience, I'm pasting the patch below as well:

>From ad09901d5446d1097cf9991a55f3b54ef13100e6 Mon Sep 17 00:00:00 2001
From: Tomas Zubiri <address@hidden>
Date: Wed, 11 Mar 2020 06:36:44 -0300
Subject: [PATCH] cp overwrites files by default, this can be disabled by using
 the command line option --no-clobber, I'm introducing an alias called
 --no-overwrites

---
 src/cp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/cp.c b/src/cp.c
index 8db2c4b9e..caaaa2cf9 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -115,6 +115,7 @@ static struct option const long_opts[] =
   {"interactive", no_argument, NULL, 'i'},
   {"link", no_argument, NULL, 'l'},
   {"no-clobber", no_argument, NULL, 'n'},
+  {"no-overwrites",no_argument,NULL, 'n'},
   {"no-dereference", no_argument, NULL, 'P'},
   {"no-preserve", required_argument, NULL, NO_PRESERVE_ATTRIBUTES_OPTION},
   {"no-target-directory", no_argument, NULL, 'T'},
@@ -180,8 +181,8 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
   -L, --dereference            always follow symbolic links in SOURCE\n\
 "), stdout);
       fputs (_("\
-  -n, --no-clobber             do not overwrite an existing file (overrides\n\
-                                 a previous -i option)\n\
+  -n, --no-clobber, --no-overwrites    do not overwrite an existing file\n\
+                                       (overrides a previous -i option)\n\
   -P, --no-dereference         never follow symbolic links in SOURCE\n\
 "), stdout);
       fputs (_("\
@@ -1152,7 +1153,7 @@ main (int argc, char **argv)
   if (make_backups && x.interactive == I_ALWAYS_NO)
     {
       error (0, 0,
-             _("options --backup and --no-clobber are mutually exclusive"));
+             _("options --backup and --no-overwrites are mutually exclusive"));
       usage (EXIT_FAILURE);
     }

-- 
2.24.1.485.gad05a3d8e5.dirty



Thanks,
Tomás, from Argentina.

Attachment: 0001-cp-overwrites-files-by-default-this-can-be-disabled-.patch
Description: Text Data


reply via email to

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