bug-coreutils
[Top][All Lists]
Advanced

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

Re: ls --group-directories-first -U


From: Jim Meyering
Subject: Re: ls --group-directories-first -U
Date: Tue, 12 Feb 2008 10:56:57 +0100

address@hidden wrote:
> J> Would you *please* consider sending a precise suggestion
> Sorry. OK, To both
>
> man page:
>        --group-directories-first
>               group directories before files
>
> And info page:
> `--group-directories-first'
>      Group all the directories before the files and then sort the
>      directories and the files separately using the selected sort key
>      (see -sort option).  That is, this option specifies a primary sort
>      key, and the -sort option specifies a secondary key.
>
> please add:
>         Doesn't work if -U or -f are present.

Thanks.
How about the following patch?

I didn't mention -f, since that option is documented to
enable --sort=none (-U) semantics.  I see that you've noticed
--group-directories-first is trumped by --sort=none even when --sort=none
comes first.

Unfortunately, --group-directories-first is a bit of a mess.  Back when
that option was added, I knew that ls should have gained a new method for
specifying multiple sort keys.  Then this option could have been added
as something like --sort=directories-first, and a secondary key would
have been specified via --yet-another-option=SECONDARY_SORT_KEY_TYPE.
But ls was already hairy in that area, too big, and with too many options, etc.

All that to say that I was tempted to change --group-directories-first,
but continue to resist :)

        ls: Improve description of --group-directories-first.
        * src/ls.c (usage) [--group-directories-first]: Improve description.
        * doc/coreutils.texi (Which files are listed): Likewise.
        Suggestion from Dan Jacobson.

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index dfab040..fbab0b5 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -5894,6 +5894,8 @@ directories and the files separately using the selected 
sort key
 (see --sort option).
 That is, this option specifies a primary sort key,
 and the --sort option specifies a secondary key.
+However, any use of @option{--sort=none}
+(@option{-U}) disables this option altogether.

 @item --hide=PATTERN
 @opindex address@hidden
diff --git a/src/ls.c b/src/ls.c
index 46713f2..e0646ef 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -4386,7 +4386,9 @@ Mandatory arguments to long options are mandatory for 
short options too.\n\
 "), stdout);
       fputs (_("\
       --group-directories-first\n\
-                             group directories before files\n\
+                             group directories before files.\n\
+                               disable with --sort=none (-U);\n\
+                               augment with any other --sort option\n\
 "), stdout);
       fputs (_("\
   -G, --no-group             in a long listing, don't print group names\n\
--
1.5.4.1.98.gf3293




reply via email to

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