Also clarify that -C and -1 only output the file name. * doc/coreutils.texi (General output formatting): Tweak the -C description to emphasize that only names are output. * src/ls.c (usage): Clarify that only names are printed with -1 and -C, and mention which is the default depending on tty output and which of ls,dir,vdir is in use.
Link: https://github.com/coreutils/coreutils/issues/405 --- doc/coreutils.texi | 2 +- src/ls.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 2c08a1fe6..44d16fe20 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -8124,7 +8124,7 @@ except that it has no effect if long format is also in effect. @itemx --format=vertical @opindex --format @opindex vertical @r{sorted files in columns} -List files in columns, sorted vertically, with no other information. +List file names in columns, sorted vertically, with no other information. This is the default for @command{ls} if standard output is a terminal. It is always the default for the @command{dir} program. GNU @command{ls} uses variable width columns to display as many files as diff --git a/src/ls.c b/src/ls.c index 71fed3a9a..4082caf67 100644 --- a/src/ls.c +++ b/src/ls.c @@ -5461,9 +5461,21 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\ with -l: show ctime and sort by name;\n\ otherwise: sort by ctime, newest first\n\ ")); +if (ls_mode == LS_LS) oputs (_("\ -C\n\ - list entries by columns\n\ + list file names by columns, sorted vertically;\n\ + the default format if standard output is a terminal\n\ +")); +else if (ls_mode == LS_MULTI_COL) + oputs (_("\ + -C\n\ + list file names by columns, sorted vertically; the default format\n\ +")); +else + oputs (_("\ + -C\n\ + list file names by columns, sorted vertically\n\ ")); oputs (_("\ --color[=WHEN]\n\ @@ -5553,6 +5565,12 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\ default to 1024-byte blocks for file system usage;\n\ used only with -s and per directory totals\n\ ")); +if (ls_mode == LS_LONG_FORMAT) + oputs (_("\ + -l\n\ + use a long listing format; the default\n\ +")); +else oputs (_("\ -l\n\ use a long listing format\n\ @@ -5681,9 +5699,16 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\ --zero\n\ end each output line with NUL, not newline\n\ ")); +if (ls_mode == LS_LS) + oputs (_("\ + -1\n\ + list one file name per line;\n\ + the default format if standard output is not a terminal\n\ +")); +else oputs (_("\ -1\n\ - list one file per line\n\ + list one file name per line\n\ ")); oputs (HELP_OPTION_DESCRIPTION); oputs (VERSION_OPTION_DESCRIPTION); -- 2.56.0
