On 30/11/2020 13:21, 積丹尼 Dan Jacobson wrote:
I got this brilliant idea.
Let's say one likes the output of
$ date --iso-8601=seconds
2020-11-30T21:15:47+08:00
but wants to know "how you did it?"
Hmmm, no assistance from
$ date --iso-8601=seconds --debug
2020-11-30T21:15:50+08:00
Ah, if only there were a:
$ date --iso-8601=seconds --expose-flags
date +%Y-%m-%dT%H:%M:%S%z
Then one needn't use trial and error to figure out the template being
used behind the scenes!
A useful idea.
I'll add that with the following.
thanks,
Pádraig
commit 17af226bd80db3376e9137384c1ba14a8d94c434 (HEAD -> master)
Author: Pádraig Brady <p...@draigbrady.com>
Date: Mon Nov 30 19:06:59 2020 +0000
date: with --debug, output the format used
* src/date.c (main): The format can be determined from
--options or the locale, so it's useful to output
the format string being used.
Addresses https://bugs.gnu.org/44960
diff --git a/src/date.c b/src/date.c
index c33fa3fc5..20af782df 100644
--- a/src/date.c
+++ b/src/date.c
@@ -505,6 +505,9 @@ main (int argc, char **argv)
}
}
+ if (parse_datetime_flags & PARSE_DATETIME_DEBUG)
+ error (0, 0, _("using date format %s"), quote (format));
+
char const *tzstring = getenv ("TZ");
timezone_t tz = tzalloc (tzstring);