From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id eJWdMXekqV4OKwAA0tVLHw (envelope-from ) for ; Wed, 29 Apr 2020 15:59:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MMe6OYCkqV4SKgAAbx9fmQ (envelope-from ) for ; Wed, 29 Apr 2020 16:00:00 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9AA5794017B for ; Wed, 29 Apr 2020 15:59:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 09C476DE10D2; Wed, 29 Apr 2020 08:59:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZUnXsmawwXRH; Wed, 29 Apr 2020 08:59:54 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 20EAB6DE10AD; Wed, 29 Apr 2020 08:59:53 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E60776DE10AD for ; Wed, 29 Apr 2020 08:59:51 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nAYF-TzqYQOu for ; Wed, 29 Apr 2020 08:59:51 -0700 (PDT) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by arlo.cworth.org (Postfix) with ESMTPS id DDD4F6DE102B for ; Wed, 29 Apr 2020 08:59:50 -0700 (PDT) Received: by mail-qk1-f194.google.com with SMTP id o135so2482748qke.6 for ; Wed, 29 Apr 2020 08:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=krGMCs8zlUUBCRrjI2c8rJ0HQpFsTa24u+i+7WuYYLc=; b=GixLTjw9vEA5c/XaXKdK0Grb/cEb8HtyLPuvi72bKfcRt9AoGRRK7dfhNSfvfDrzev u1WspufulIk+U9gzb0+VZo03DL6uOxPszNRtLry7LMUwOoDOsX0CsS+ChQrg4o/eXvJt 6Ekb6GFJUS0bjsIFJcf331OKw4Lu1cuiQ2TmcdByLJ5BPdSUpmTn4nHwpro0BhXnD2eJ 4t20NJayIuTXnr0ao29rJbzEhsmCefPWM99tzXIyYW/UVxSXElPRKTJZXrS0YV+bkG+D 7I5ZmlCkvXA5JthAupEGZeMyM3M8iH1Gf0fCOyQXcCA3X3It26qDf0JfJ86KISF8/+E6 5mDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=krGMCs8zlUUBCRrjI2c8rJ0HQpFsTa24u+i+7WuYYLc=; b=OG1T7w14UzIKAPvOgLiVVd0zUuDRv4H9K5+JQEr7KN4vzON9Chg3AZwWnyhSY0qwxt 77byN8EoTp4oVqKqD6FvNz2fjw9T4bZHn8X26gAiBGRlj7DyxB3Oxe9E4cFSHGUwIo4O IXb6vrsb4VzI+fGu6QIX785FmaDZoL4QOK0UM8vAwUaS83//Zj3H72/EwHkd3TyCGU42 282eMz1sWHyUvRTeCj1vOre5IEYdpO9jsxrm7UrBuubYmTeENwzWrvshcO/R30TskBxd bjPd/CK+EPcKvQftS4ChsSzQTVBTNYrFxdjxE06M9GdLWsRF13osf0cY61OcVpFQhprf P43g== X-Gm-Message-State: AGi0Pub9nSXe+GENV0xdtIXPp3TnFtNoa57bf1azpu2+32DwlTDwTb93 K3PnN3esAfH7Ye8NtkfbYdnbFOCOEFwlL9KGsnb48w== X-Google-Smtp-Source: APiQypLAMPa/DonqzrjvsLmCEDTtJnFVRNLSqcfkuVny6Ac6RNuYxOPIxubsvdm+2yZmVhVcdRF02aBrlUvLzBQnDjE= X-Received: by 2002:a05:620a:16b0:: with SMTP id s16mr33912176qkj.204.1588175989936; Wed, 29 Apr 2020 08:59:49 -0700 (PDT) MIME-Version: 1.0 References: <87imhk95oc.fsf@tethera.net> <87k120x0wh.fsf@fifthhorseman.net> <87blnbvxx4.fsf@fifthhorseman.net> <87pnbql2sg.fsf@tethera.net> In-Reply-To: <87pnbql2sg.fsf@tethera.net> From: Ciprian Dorin Craciun Date: Wed, 29 Apr 2020 18:59:13 +0300 Message-ID: Subject: Re: Inconsistencies in handling command flags: `--flag=value` different than `--flag value` To: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: notmuch@notmuchmail.org, Daniel Kahn Gillmor Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: 0.09 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=gmail.com header.s=20161025 header.b=GixLTjw9; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [0.09 / 13.00]; GENERIC_REPUTATION(0.00)[-0.46235526540065]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:c]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; DWL_DNSWL_FAIL(0.00)[50.126.95.6:server fail]; FREEMAIL_FROM(0.00)[gmail.com]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.18), country: US(-0.00), ip: 50.126.95.6(-0.46)]; DKIM_TRACE(0.00)[gmail.com:-]; MX_GOOD(-0.50)[cached: notmuchmail.org]; MAILLIST(-0.20)[mailman]; RCVD_IN_DNSWL_FAIL(0.00)[50.126.95.6:server fail]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[cipriancraciun@gmail.com,notmuch-bounces@notmuchmail.org]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[tethera.net:email,notmuchmail.org:email]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; HAS_LIST_UNSUB(-0.01)[]; RCVD_COUNT_SEVEN(0.00)[8]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: H22Z5yYVrwD8 On Wed, Apr 29, 2020 at 6:39 PM David Bremner wrote: > I guess I'm a bit leery of removing UI features that presumably at least > some people rely on. It's pretty upsetting to have sofware break one's > muscle memory. I think there are two complete different use-cases for the `notmuch` binary: * a simple CLI to query the database, in which case the current flags seem OK; * a "poor-mans" API to query the database, more bellow; (I know there already exists an `libnotmuch` API accessible in many programming languages. However for prototyping, and even for safety and robustness, when performance isn't an issue, I find the tool-based approach much more resilient.) Now about the "API" use-case, I assume that at the moment many users have already integrated `notmuch` as it is with the current flags and behaviour. Thus I agree that changing any flags in backward incompatible way would make a lot of people unhappy, and will generate perhaps quite a bit of "customer support". :) However, even with my `--strict` argument, I was perhaps leaning toward adding a more API-friendly command line parser, that would basically only take arguments in the form `--flag=value`, anything else being considered a search term, and anything not a flag but before a single `--` should be considered an error. Regarding the `--boolean` vs `--no-boolean` it does solve the strictness problem, however it makes the life of script developers quite hard, as now he has a `case` or `if/then/else`. Therefore I would say that `--flag=value` is the best option as it can be simply written as `--flag={FLAG:-true}` or in Python for example `"--flag=%s" % _flag`. Thinking even further uppon this, perhaps an even simpler idea would be to provide a new command, like for example `notmuch api` that takes on `stdin` a JSON with a specific format and does its job. Ciprian.