I was playing around with testing all aliases are supported. The attached script outputs:
chown --quiet --silent --version date --rfc-email --rfc-822 --rfc-2822 --version date --uct --utc --universal --version dircolors --bourne-shell --sh --version dircolors --csh --c-shell --version head --quiet --silent --version That's is only after I adjusted date.c in the attached to behave in a more standard manner and support overriding named formats (patch also attached). Without the patch even repeated options fail. I.e. `date --rfc-email --rfc-email` would fail. cheers, Padraig
From c822470e65c729cae9a1727bffb466b44042693c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]> Date: Sat, 6 Sep 2025 20:41:29 +0100 Subject: [PATCH] date: support overriding named formats * src/date.c (main): Allow specifying different named formats, with the last specified taking precedence. --- src/date.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/date.c b/src/date.c index 42e66e25d..f3a8241cf 100644 --- a/src/date.c +++ b/src/date.c @@ -487,8 +487,6 @@ main (int argc, char **argv) while ((optc = getopt_long (argc, argv, short_options, long_options, nullptr)) != -1) { - char const *new_format = nullptr; - switch (optc) { case 'd': @@ -516,7 +514,7 @@ main (int argc, char **argv) enum Time_spec i = XARGMATCH ("--rfc-3339", optarg, time_spec_string + 2, time_spec + 2); - new_format = rfc_3339_format[i]; + format = rfc_3339_format[i]; format_in_c_locale = true; break; } @@ -534,7 +532,7 @@ main (int argc, char **argv) (optarg ? XARGMATCH ("--iso-8601", optarg, time_spec_string, time_spec) : TIME_SPEC_DATE); - new_format = iso_8601_format[i]; + format = iso_8601_format[i]; format_in_c_locale = true; break; } @@ -542,7 +540,7 @@ main (int argc, char **argv) reference = optarg; break; case 'R': - new_format = rfc_email_format; + format = rfc_email_format; format_in_c_locale = true; break; case 's': @@ -564,13 +562,6 @@ main (int argc, char **argv) default: usage (EXIT_FAILURE); } - - if (new_format) - { - if (format) - error (EXIT_FAILURE, 0, _("multiple output formats specified")); - format = new_format; - } } int option_specified_date = (!!datestr + !!batch_file + !!reference -- 2.50.1
aliases.sh
Description: application/shellscript
