unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>,
	Tomi Ollila <tomi.ollila@iki.fi>
Cc: notmuch@notmuchmail.org
Subject: Re: Inconsistencies in handling command flags: `--flag=value` different than `--flag value`
Date: Tue, 28 Apr 2020 22:16:39 -0400	[thread overview]
Message-ID: <87blnbvxx4.fsf@fifthhorseman.net> (raw)
In-Reply-To: <CA+Tk8fxGvqqfO3y2o7gToWLt=Sp5NxYNdbAi2tcGyWWGEzxuWg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2801 bytes --]

On Mon 2020-04-27 22:21:36 +0300, Ciprian Dorin Craciun wrote:
> On Mon, Apr 27, 2020 at 9:21 PM Tomi Ollila <tomi.ollila@iki.fi> wrote:
>>> [dkg wrote:]
>>> release, remove the suggestion to use a whitespace separator from the
>>> documentation, and eventually phase it out entirely in some future
>>> release.
>>
>> Alternatively we could check that next arg is (case-insensitively)
>> (subset of) 'true', 'false', 'yes', 'no', '0', '1', 't', 'nil'
>> (but not tpyoes of these ;) and in that case have that as an option
>> value...
>
> This would be perhaps the best approach.  However I don't think it
> would solve the issues for integrators that would not see these
> warnings in the logs, until it is too late.

this looks really ugly to me, in that some legitimate queries
(e.g. those that include terms like "true" or "1") might not be
accessible, unless the user supplies --booloption=true instead of
--booloption.

I mean, these are all slightly idiosyncratic corner cases, but this
particular corner case looks super ugly and hard to explain to me.  i'm
trying to imagine writing some example text that explains it for the man
page, and it comes out horribly complex!  If we can't explain it
succinctly in the manpage, should we be implementing it?

> Perhaps there could be an additional option (either on the command
> line or in the configuration) that would apply "strict" checking, and
> not letting any other form except `--argument=value`, including the
> boolean flags, and failing loudly.
>
> I think this third option would enable much safer integrations.
>
> (BTW, this "strict" option could also apply to the parsing of the
> search terms, which most of the time are under the control of the end
> user.)

I've spent many years helping to maintain GnuPG now, and i'm pretty wary
of having contextually different modes of argument parsing and
interacting/intersecting arguments.  It also leads to some weird
ambiguities: if --strict is supplied on the command line, then does it
need to be first on the command line?  or could parsing the command line
turn out different if you tack on --strict at the end?  Seems like we'd
be injecting additional idiosyncracies to chase after the first.

One final way we could normalize everything and make it less
idiosyncratic, with shorter, simpler man pages: deprecate and then drop
the --booloption/--no-booloption mechanisms, requiring --booloption=true
or --booloption=false instead.  Once they're dropped, allow whitespace
between "--booloption true" and "--booloption false" just like every
other type of option.



in case it's not clear: I believe that "we have succinct and yet
complete man pages" is a convenient shorthand for "have we made this
command-line program behave in an understandable/usable way?"

               --dkg

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2020-04-29  2:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 12:53 Inconsistencies in handling command flags: `--flag=value` different than `--flag value` Ciprian Dorin Craciun
2020-04-27 17:53 ` David Bremner
2020-04-27 18:02   ` Daniel Kahn Gillmor
2020-04-27 18:20     ` Tomi Ollila
2020-04-27 19:21       ` Ciprian Dorin Craciun
2020-04-29  2:16         ` Daniel Kahn Gillmor [this message]
2020-04-29 14:18           ` Tomi Ollila
2020-04-29 15:39             ` David Bremner
2020-04-29 15:45               ` Jameson Graef Rollins
2020-04-29 16:28                 ` David Bremner
2020-05-05 18:28                 ` Carl Worth
2020-05-07 19:26                   ` [PATCH] notmuch(1): clarify documentation about --option/value separators Daniel Kahn Gillmor
2020-05-07 23:40                     ` Carl Worth
2020-05-08 12:01                       ` David Bremner
2020-05-08 16:06                       ` Daniel Kahn Gillmor
2020-04-29 15:59               ` Inconsistencies in handling command flags: `--flag=value` different than `--flag value` Ciprian Dorin Craciun
2020-04-29 16:07                 ` Jameson Graef Rollins
2020-04-29 15:33           ` Jameson Graef Rollins
2020-04-30 16:59             ` Daniel Kahn Gillmor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blnbvxx4.fsf@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=ciprian.craciun@gmail.com \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).