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

On Mon, Apr 27, 2020 at 9:21 PM Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > On Mon 2020-04-27 14:53:07 -0300, David Bremner wrote:
> >> Quoting notmuch(1)
> >>
> >>    OPTION SYNTAX
> >>        All options accepting an argument can be used with '='
> >>        or ':' as a separator. For the cases where it's not ambiguous
> >>        (in particular excluding boolean options), a space can also be
> >>        used.


I definitively skipped over that warning, mainly because I was reading
the man-page for the specific command (i.e. `notmuch-search`, etc.)
that don't feature that warning.

Please note that I understand "why" I get this behavior, and
definitively I agree that it's my fault.  However my initial report
was intended to find a way that new users don't shoot themselves in
the foot, especially since many will use `notmuch` from a script, and
sometimes they don't thoroughly check the arguments passed by the
user.



> > Alternately, we could deprecate using whitespace for all options,
> > produce explicit warnings to stderr when whitespace appears on the next
>
> was it so, that originally we did not support whitespace, but David
> added that in some commit...


From a "correctness" point of view, this would be the best approach.
However I think it could be too late to introduce it, and it would
break too many integrations.



> > 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.



> ... would that work better for human user who just wants to be
> fluent on command line -- frontends can then always use = and option
> values...


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.)

Ciprian.

  reply	other threads:[~2020-04-27 19:22 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 [this message]
2020-04-29  2:16         ` Daniel Kahn Gillmor
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='CA+Tk8fxGvqqfO3y2o7gToWLt=Sp5NxYNdbAi2tcGyWWGEzxuWg@mail.gmail.com' \
    --to=ciprian.craciun@gmail.com \
    --cc=dkg@fifthhorseman.net \
    --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).