Subject: Re: bug#44959: date error message should say -I

From: Pádraig Brady <[email-masked]>
Date: Mon, 30 Nov 2020 21:31:56 +0000

On 30/11/2020 17:22, Pádraig Brady wrote:
> On 30/11/2020 15:21, 積丹尼 Dan Jacobson wrote:
>> Well OK, but when and when not to use the "=" is not revealed by the
>> otherwise detailed error messages. So unless the user checks the manual,
>> they will never "get it".
> 
> If we were to recognize "-I seconds",
> it should just be for diagnostic help.
> I.e. we should minimize the combinations of valid inputs,
> for compatibility, consistency, and simplicity.
> 
> I'll have a look at improving diagnostics in this area.

This is one of the reasons we avoid args to short options,
and new short options in general.
Optional args to short options are rare in coreutils:

   $ grep -- '-[[:alpha:]]\[[A-Z]' man/*.1 | sed 's/,.*//'
   man/date.1:\fB\-I[FMT]\fR
   man/od.1:\fB\-w[BYTES]\fR
   man/pr.1:\fB\-e[CHAR[WIDTH]]\fR
   man/pr.1:\fB\-i[CHAR[WIDTH]]\fR
   man/pr.1:\fB\-n[SEP[DIGITS]]\fR
   man/pr.1:\fB\-s[CHAR]\fR
   man/pr.1:\fB\-s[CHAR]\fR turns off line truncation of all 3 column
   man/pr.1:\fB\-S[STRING]\fR

Non option args to short options as less rare:

   $ grep 'B\\-[^\].*=' man/*.1

For my reference, if we were to give explicit diagnosis of the leading '='.
we would need to update xstrtol_fatal, XARGMATCH, operand2sig, set_fields, ...

cheers,
Pádraig