bug-coreutils
[Top][All Lists]
Advanced

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

"--to" option for mv and friends


From: James R. Van Zandt
Subject: "--to" option for mv and friends
Date: Sun, 30 Aug 2009 15:32:27 -0400

Jim Meyering wrote:
> Considering all the talk of "DEST" and "destination", I can see how
> the use of "target" in that option name can make it harder to remember.
> A new option might be worthwhile after all.

Thanks.

> However, --to=... might make someone think that the
> argument could be a non-directory.

Well, the help entry

   ... --to=DIRECTORY ...

makes it pretty clear.  Also, the first time he tried it with a
non-directory argument, it would fail with an explanation.

> So how about --to-dir=..., which could still be abbreviated to --to.

I'd accept that reluctantly - provided the info page includes an
example using the abbreviation.  (As an aside, the info page says
"Most programs that accept long options recognize unambiguous
abbreviations of those options", but I couldn't find any statement
that mv does.)  

I'm attaching a revised patch along those lines.  (I put the example
on each program's info page, rather than on the separate "target
directory" page, because I suspect each additional link loses at least
half the users.)

I hereby assign the copyright for this patch to the Free Software
Foundation.

            - Jim Van Zandt

--- ../coreutils-7.4.orig/src/cp.c      2009-04-24 08:50:28.000000000 -0400
+++ src/cp.c    2009-08-30 15:05:21.000000000 -0400
@@ -125,6 +125,7 @@
   {"suffix", required_argument, NULL, 'S'},
   {"symbolic-link", no_argument, NULL, 's'},
   {"target-directory", required_argument, NULL, 't'},
+  {"to-dir", required_argument, NULL, 't'},
   {"update", no_argument, NULL, 'u'},
   {"verbose", no_argument, NULL, 'v'},
   {GETOPT_HELP_OPTION_DECL},
@@ -201,7 +202,8 @@
       fputs (_("\
   -s, --symbolic-link          make symbolic links instead of copying\n\
   -S, --suffix=SUFFIX          override the usual backup suffix\n\
-  -t, --target-directory=DIRECTORY  copy all SOURCE arguments into DIRECTORY\n\
+  -t, --to-dir=DIRECTORY, --target-directory=DIRECTORY  copy all SOURCE 
arguments\n\
+                                 into DIRECTORY\n\
   -T, --no-target-directory    treat DEST as a normal file\n\
 "), stdout);
       fputs (_("\
--- ../coreutils-7.4.orig/src/install.c 2009-04-24 08:59:06.000000000 -0400
+++ src/install.c       2009-08-30 15:05:21.000000000 -0400
@@ -157,6 +157,7 @@
   {"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION},
   {"suffix", required_argument, NULL, 'S'},
   {"target-directory", required_argument, NULL, 't'},
+  {"to-dir", required_argument, NULL, 't'},
   {"verbose", no_argument, NULL, 'v'},
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
@@ -980,7 +981,8 @@
   -s, --strip         strip symbol tables\n\
       --strip-program=PROGRAM  program used to strip binaries\n\
   -S, --suffix=SUFFIX  override the usual backup suffix\n\
-  -t, --target-directory=DIRECTORY  copy all SOURCE arguments into DIRECTORY\n\
+  -t, --to-dir=DIRECTORY, --target-directory=DIRECTORY  copy all SOURCE 
arguments\n\
+                                 into DIRECTORY\n\
   -T, --no-target-directory  treat DEST as a normal file\n\
   -v, --verbose       print the name of each directory as it is created\n\
 "), stdout);
--- ../coreutils-7.4.orig/src/ln.c      2009-04-24 08:41:19.000000000 -0400
+++ src/ln.c    2009-08-30 15:05:21.000000000 -0400
@@ -103,6 +103,7 @@
   {"interactive", no_argument, NULL, 'i'},
   {"suffix", required_argument, NULL, 'S'},
   {"target-directory", required_argument, NULL, 't'},
+  {"to-dir", required_argument, NULL, 't'},
   {"symbolic", no_argument, NULL, 's'},
   {"verbose", no_argument, NULL, 'v'},
   {GETOPT_HELP_OPTION_DECL},
@@ -383,8 +384,8 @@
 "), stdout);
       fputs (_("\
   -S, --suffix=SUFFIX         override the usual backup suffix\n\
-  -t, --target-directory=DIRECTORY  specify the DIRECTORY in which to create\n\
-                                the links\n\
+  -t, --to-dir=DIRECTORY, --target-directory=DIRECTORY  specify the 
DIRECTORY\n\
+                                in which to create the links\n\
   -T, --no-target-directory   treat LINK_NAME as a normal file\n\
   -v, --verbose               print name of each linked file\n\
 "), stdout);
--- ../coreutils-7.4.orig/src/mv.c      2009-05-03 16:05:34.000000000 -0400
+++ src/mv.c    2009-08-30 15:05:21.000000000 -0400
@@ -62,6 +62,7 @@
   {"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
   {"suffix", required_argument, NULL, 'S'},
   {"target-directory", required_argument, NULL, 't'},
+  {"to-dir", required_argument, NULL, 't'},
   {"update", no_argument, NULL, 'u'},
   {"verbose", no_argument, NULL, 'v'},
   {GETOPT_HELP_OPTION_DECL},
@@ -304,7 +305,8 @@
   -S, --suffix=SUFFIX          override the usual backup suffix\n\
 "), stdout);
       fputs (_("\
-  -t, --target-directory=DIRECTORY  move all SOURCE arguments into DIRECTORY\n\
+  -t, --to-dir=DIRECTORY, --target-directory=DIRECTORY  move all SOURCE 
arguments\n\
+                                 into DIRECTORY\n\
   -T, --no-target-directory    treat DEST as a normal file\n\
   -u, --update                 move only when the SOURCE file is newer\n\
                                  than the destination file or when the\n\
--- ../coreutils-7.4.orig/doc/coreutils.texi    2009-05-05 17:24:31.000000000 
-0400
+++ doc/coreutils.texi  2009-08-30 14:59:21.000000000 -0400
@@ -549,14 +549,22 @@
 @xref{Backup options}.
 @end macro
 
address@hidden optTargetDirectory
address@hidden optTargetDirectory{PROG}
 @item -t @var{directory}
 @itemx @address@hidden@var{directory}}
address@hidden @address@hidden@var{directory}}
 @opindex -t
 @opindex --target-directory
address@hidden --to-dir
 @cindex target directory
 @cindex destination directory
-Specify the destination @var{directory}.
+Specify the destination @var{directory}.  For example (using a
+convenient abbreviation):
+
address@hidden
+\PROG\ --to ../src  this.c that.c other.c
address@hidden smallexample
+
 @xref{Target directory}.
 @end macro
 
@@ -1195,11 +1203,13 @@
 
 In the opposite situation, where you want the last operand to be
 treated as a directory and want a diagnostic otherwise, you can use
-the @option{--target-directory} (@option{-t}) option.
+the @option{--target-directory} (@option{--to-dir}, @option{-t}) option.
 
 @item -t @var{directory}
 @itemx @address@hidden@var{directory}}
address@hidden @address@hidden@var{directory}}
 @opindex --target-directory
address@hidden --to-dir
 @cindex target directory
 @cindex destination directory
 Use @var{directory} as the directory component of each destination
@@ -1221,7 +1231,7 @@
 shell command, but that requires more human labor and brain power than
 it should.)
 
-The @address@hidden (@option{-t}) option allows the @command{cp},
+The @address@hidden (@option{--to-dir}, @option{-t}) option allows the 
@command{cp},
 @command{install}, @command{ln}, and @command{mv} programs to be used
 conveniently with @command{xargs}.  For example, you can move the files
 from the current directory to a sibling directory, @code{d} like this:
@@ -1254,7 +1264,7 @@
 @end table
 
 @noindent
-The @option{--target-directory} (@option{-t}) and
+The @option{--target-directory} (@option{--to-dir}, @option{-t}) and
 @option{--no-target-directory} (@option{-T})
 options cannot be combined.
 
@@ -7218,7 +7228,8 @@
 second.
 
 @item
-If the @option{--target-directory} (@option{-t}) option is given, or
+If the @option{--target-directory} (@option{--to-dir}, @option{-t}) option 
+is given, or
 failing that if the last file is a directory and the
 @option{--no-target-directory} (@option{-T}) option is not given,
 @command{cp} copies each @var{source} file to the specified directory,
@@ -7962,7 +7973,8 @@
 second.
 
 @item
-If the @option{--target-directory} (@option{-t}) option is given, or
+If the @option{--target-directory} (@option{--to-dir}, @option{-t}) option 
+is given, or
 failing that if the last file is a directory and the
 @option{--no-target-directory} (@option{-T}) option is not given,
 @command{install} copies each @var{source} file to the specified
@@ -8132,7 +8144,8 @@
 second.
 
 @item
-If the @option{--target-directory} (@option{-t}) option is given, or
+If the @option{--target-directory} (@option{--to-dir}, @option{-t}) 
+option is given, or
 failing that if the last file is a directory and the
 @option{--no-target-directory} (@option{-T}) option is not given,
 @command{mv} moves each @var{source} file to the specified
@@ -8714,7 +8727,8 @@
 in the current directory.
 
 @item
-If the @option{--target-directory} (@option{-t}) option is given, or
+If the @option{--target-directory} (@option{--to-dir}, @option{-t}) option 
+is given, or
 failing that if the last file is a directory and the
 @option{--no-target-directory} (@option{-T}) option is not given,
 @command{ln} creates a link to each @var{target} file in the specified




reply via email to

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