diff options
author | Pádraig Brady <P@draigBrady.com> | 2022-02-13 18:19:04 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2022-02-13 18:25:59 +0000 |
commit | abc4533fe4b7eba1c92263f49145713ff5fc0c3c (patch) | |
tree | 9e08ce78f45c0fafa69dde87b9af92819d730134 /tests | |
parent | 26db930c81701953d2850289bd6a835362ff8cd0 (diff) | |
download | coreutils-abc4533fe4b7eba1c92263f49145713ff5fc0c3c.tar.gz |
dircolors: add --print-ls-colors to display colored entries
* NEWS: Mention the new feature.
* doc/coreutils.texi (dircolors invocation): Describe the new
--print-ls-colors option.
* src/dircolors.c (print_ls_colors): A new global to select
between shell or terminal output.
(append_entry): A new function refactored from dc_parse_stream()
to append the entry in the appropriate format.
(dc_parse_stream): Adjust to call append_entry().
* tests/misc/dircolors.pl: Add test cases.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/dircolors.pl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/misc/dircolors.pl b/tests/misc/dircolors.pl index 942505e90..27fa2c5b6 100755 --- a/tests/misc/dircolors.pl +++ b/tests/misc/dircolors.pl @@ -42,8 +42,22 @@ my @Tests = ['term-4', '-b', {IN => "TERM N*match\nowt 40;33\n"}, {OUT => "LS_COLORS='';\nexport LS_COLORS\n"}], + ['print-clash1', '-p', '--print-ls', + {ERR => "dircolors: options --print-database and --print-ls-colors " . + "are mutually exclusive\n" . + "Try 'dircolors --help' for more information.\n"}, + {EXIT => 1}], + ['print-clash2', '-b', '--print-database', + {ERR => "dircolors: the options to output non shell syntax,\n" . + "and to select a shell syntax are mutually exclusive\n" . + "Try 'dircolors --help' for more information.\n"}, + {EXIT => 1}], + + ['print-ls-colors', '--print-ls-colors', {IN => "OWT 40;33\n"}, + {OUT => "\x1B[40;33mtw\t40;33\x1B[0m\n"}], + # CAREFUL: always specify the -b option, unless explicitly testing - # for csh syntax output. + # for csh syntax output, or --print-ls-color output. ); my $save_temps = $ENV{DEBUG}; |