mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
ls: --dired now implies long format with hyperlinks disabled
Currently --dired is silently ignored with conflicting output formats * src/ls.c (decode_switches): Set default format and hyperlink mode when the --dired option is specified. * tests/ls/dired.sh: Check that formats are implied / overridden. * NEWS: Mention the change in behavior. * doc/coreutils.texi (ls invocation): Adjust --dired description.
This commit is contained in:
1 parent
3564e3a572
commit
8367b95a13
4 files changed
+17
-9
No files matched your search
@@ -11,6 +11,11 @@ GNU coreutils NEWS -*- outline -*-
|
||||
numfmt options like --suffix no longer have an arbitrary 127-byte limit.
|
||||
[bug introduced with numfmt in coreutils-8.21]
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
ls --dired now implies long format output without hyperlinks enabled,
|
||||
and will take precedence over previously specified formats or hyperlink mode.
|
||||
|
||||
|
||||
* Noteworthy changes in release 9.4 (2023-08-29) [stable]
|
||||
|
||||
|
||||
+3
-3
@@ -7890,9 +7890,9 @@ should either specify an explicit @option{--quoting-style=literal}
|
||||
(@option{-N}) option on the command line, or else be
|
||||
prepared to parse the escaped names.
|
||||
|
||||
The @option{--dired} (@option{-D}) option has well-defined behavior
|
||||
only when long format is in effect and hyperlinks are disabled (e.g.,
|
||||
@option{--hyperlink=none}).
|
||||
The @option{--dired} (@option{-D}) option implies long format output
|
||||
with hyperlinks disabled, and takes precedence over previously specified
|
||||
output formats or hyperlink mode.
|
||||
|
||||
@item --full-time
|
||||
@opindex --full-time
|
||||
|
||||
@@ -2054,6 +2054,8 @@ decode_switches (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
format_opt = long_format;
|
||||
print_hyperlink = false;
|
||||
dired = true;
|
||||
break;
|
||||
|
||||
@@ -2377,9 +2379,8 @@ decode_switches (int argc, char **argv)
|
||||
dirname_quoting_options = clone_quoting_options (nullptr);
|
||||
set_char_quoting (dirname_quoting_options, ':', 1);
|
||||
|
||||
/* --dired is meaningful only with --format=long (-l) and sans --hyperlink.
|
||||
Otherwise, ignore it. FIXME: warn about this?
|
||||
Alternatively, make --dired imply --format=long? */
|
||||
/* --dired implies --format=long (-l) and sans --hyperlink.
|
||||
So ignore it if those overridden. */
|
||||
dired &= (format == long_format) & !print_hyperlink;
|
||||
|
||||
if (eolbyte < dired)
|
||||
|
||||
+5
-3
@@ -19,18 +19,20 @@
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ ls
|
||||
|
||||
|
||||
# Check with constant positions
|
||||
mkdir dir || framework_failure_
|
||||
|
||||
LC_MESSAGES=C ls -lR --dired dir > out || fail=1
|
||||
cat <<EOF > exp
|
||||
dir:
|
||||
total 0
|
||||
//SUBDIRED// 2 5
|
||||
//DIRED-OPTIONS// --quoting-style=literal
|
||||
EOF
|
||||
|
||||
compare exp out || fail=1
|
||||
for opt in '-l' '' '--hyperlink' '-x'; do
|
||||
LC_MESSAGES=C ls $opt -R --dired dir > out || fail=1
|
||||
compare exp out || fail=1
|
||||
done
|
||||
|
||||
|
||||
# Check with varying positions (due to usernames etc.)
|
||||
|
||||
Reference in new issue
Block a user