From: Jani Nikula Date: Tue, 3 Apr 2012 08:21:31 +0000 (+0000) Subject: Re: [PATCH 6/8] cli: add support for batch tagging operations to "notmuch tag" X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=3da53213ba1e6e2d8209db4cb105dd47288f7985;p=notmuch-archives.git Re: [PATCH 6/8] cli: add support for batch tagging operations to "notmuch tag" --- diff --git a/06/a6010559a4bb9a0fdb579aa82366daa1df21cf b/06/a6010559a4bb9a0fdb579aa82366daa1df21cf new file mode 100644 index 000000000..937c14160 --- /dev/null +++ b/06/a6010559a4bb9a0fdb579aa82366daa1df21cf @@ -0,0 +1,122 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 56B77431FB6 + for ; Tue, 3 Apr 2012 01:21:37 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id os68jCbN4LYb for ; + Tue, 3 Apr 2012 01:21:36 -0700 (PDT) +Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com + [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A481C431FAE + for ; Tue, 3 Apr 2012 01:21:36 -0700 (PDT) +Received: by qatm19 with SMTP id m19so2470342qat.5 + for ; Tue, 03 Apr 2012 01:21:36 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type:x-gm-message-state; + bh=v/Od0crtF1prlrbcjpjBYSdger8i6Y0HfSDubwxcIJE=; + b=BWxkUlMl7hMbOMmNR19m6qF03xOKkAB/IyI0nWnjIsp2t9hIIG5xzn3YcbS/5/34L5 + m1SW5NnwexyoC/ltdIrSLvK71bcXkYimBGXbqxYrDV1g5ckmzfuDnz+D+vYkstWoOKo1 + nQXYFsL4mr+bCiEYSkI5/7kkihTodjLeowb0fYSncP4Y1rkfMC4FHC7wnYbcO2skYh9f + OWF5aVZK98J842zpMldU9Y5tkSEkTonSzpDNPrsKXnzSAmK/7dxZB8OFJjqI6s/XHd8w + JWaXiHCq+NbfA8AK/o/m3vEMRieR3moMX52R7vOd1AptAUWNziC3IkEBjB8PUt6Aljk3 + 1bKQ== +Received: by 10.224.59.204 with SMTP id m12mr15538060qah.37.1333441295985; + Tue, 03 Apr 2012 01:21:35 -0700 (PDT) +Received: from localhost (nikula.org. [92.243.24.172]) + by mx.google.com with ESMTPS id w9sm38798041qao.0.2012.04.03.01.21.32 + (version=SSLv3 cipher=OTHER); Tue, 03 Apr 2012 01:21:34 -0700 (PDT) +From: Jani Nikula +To: Jameson Graef Rollins +Subject: Re: [PATCH 6/8] cli: add support for batch tagging operations to + "notmuch tag" +In-Reply-To: <87d37p4xor.fsf@servo.finestructure.net> +References: + + <87ty123tpc.fsf@servo.finestructure.net> + <87aa2tc22z.fsf@zancas.localnet> + <87iphh50hz.fsf@servo.finestructure.net> + + <87fwcl4yr8.fsf@servo.finestructure.net> + + <87d37p4xor.fsf@servo.finestructure.net> +User-Agent: Notmuch/0.11.1+222~ga47a98c (http://notmuchmail.org) Emacs/23.1.1 + (i686-pc-linux-gnu) +Date: Tue, 03 Apr 2012 08:21:31 +0000 +Message-ID: <87pqbpxm2c.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQmhE6xzmoohG/zbOOuuKWop/TRUyk/GGOYVq+bgf3p5cyLZ005d7Oyo93FLZc6/R9KDvh+4 +Cc: Notmuch Mail +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 03 Apr 2012 08:21:37 -0000 + +On Mon, 02 Apr 2012 14:43:16 -0700, Jameson Graef Rollins wrote: +> So what if we instead modified the top level binary ("notmuch") to: +> +> * add an option to specify that commands are to be processed from stdin +> (--batch) +> +> * when in batch mode the db is opened once at the beginning and locked +> +> * commands are processed from stdin in the exact same form they are +> specified on the command line ("tag +foo -- from:bar", "search +> tag:foo", etc.). +> +> * db is closed when EOF is reached. +> +> That seems like it would be a generally much cleaner interface, and much +> more flexible. + +Yes, it's more flexible, but what are the real benefits of such +flexibility? What other commands than tag/restore would truly benefit +from this? I might add that nobody has asked for such flexibility. + +As to the cleanliness of the interface, all is well as long as no +characters needing escaping are used. With them, things get hairy. On +the command line, the shell provides the necessary escaping and quoting +mechanisms, and parsing to subcommand argv. I think it would be +confusing to require %NN style hex escaping on the command line where +shell mechanisms can be used, but also it would be a lot of work to +duplicate the shell escaping and quoting mechanisms to the stdin +parsing. For simplicity, I'd use hex escaping for stdin, and leave the +command line to the shell. + +Finally, I'm not sure how the config and database open/close could be +cleanly duplicated in top level "notmuch" and the subcommands. Should +there be logic in the subcommands not to open the config/database if +they're already opened in top level? All of notmuch cli should also be +reworked to pass the config and database on to the subcommands. Not all +the commands need to open the database in read/write mode, and some +commands don't need to open the database at all, so it would not make +sense to move config/database open/close to top level completely. + +In summary, I don't see enough value in this to put all the work +required into it. I think it's way more trouble than it's worth. + + +BR, +Jani.