From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 72AFE431FAF for ; Tue, 29 Jan 2013 13:46:34 -0800 (PST) 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 iUEucyQeCj46 for ; Tue, 29 Jan 2013 13:46:34 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C3C7E431FAE for ; Tue, 29 Jan 2013 13:46:33 -0800 (PST) Received: by mail-lb0-f179.google.com with SMTP id j14so1343227lbo.10 for ; Tue, 29 Jan 2013 13:46:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer :x-gm-message-state; bh=Z6oA6oC6S0B7Bw9msvbr5mprubrSfIIpyfulPOTa3YQ=; b=KwJxFu+V7n+mzLKcyzm1tw31V8jbev0C1pY6M/OJAXSIXiNPONjD4UbVncvphLTSUo 3psRP5A37KrSfuMnEmZuauEenfXfIvjMP3/kbADU8i0Up1iq4ImPjsjNq7ZHvFDd/5bF wUFjGPZcc20ktMw42oMkhEdS7/0ugCzCwOpehe9icJR7uOa3/uEHdaZzYVj5E+1IaIrA 2mvYV3q6ycDUcW8syL9uDXjg6ILhv7hfGWKMZ6lbzRhwozS0LQCSyDJ+PgjWvwOf/DbC nAABRpmTxpEsFrde+sSJT0MGEhpnUGpRWOAr4NoUBNdxOICNHiAYSg2T6C8u7K+88A7M GaLw== X-Received: by 10.112.45.201 with SMTP id p9mr1076792lbm.13.1359495989959; Tue, 29 Jan 2013 13:46:29 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id go4sm5059807lbb.16.2013.01.29.13.46.25 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 29 Jan 2013 13:46:28 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 0/6] notmuch cli config changes Date: Tue, 29 Jan 2013 23:46:18 +0200 Message-Id: X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQl+/kgLALrSKCrs3D5G8kOylJiasgT9Fg7RYbx6AmkbSN8J14oY1Et14AW+v/u5xjnrrncU 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, 29 Jan 2013 21:46:34 -0000 Hi all, the goal here is to add support for --config=FILE option at the notmuch top level (e.g. 'notmuch --config=FILE search foo'). In order to achieve this neatly, I ended up moving config open/close to main() from subcommands. This isn't a bad thing, because all notmuch commands opened the config file anyway. As an added bonus, after this it should be trivial to 1) add top level command line arguments to override config, or 2) add global command line parameters passed on to subcommands via config (even if not stored in the config file). In the end this results in a net reduction of code. BR, Jani. Jani Nikula (6): cli: keep track of whether the config is newly created cli: make notmuch_config_open() "is new" parameter input only cli: abstract subcommand finding into a new function cli: plug main notmuch command into subcommand machinery cli: move config open/close to main() from subcommands cli: add top level --config=FILE option notmuch-client.h | 35 ++++++------- notmuch-config.c | 73 +++++++++----------------- notmuch-count.c | 11 ++-- notmuch-dump.c | 7 +-- notmuch-new.c | 17 +++---- notmuch-reply.c | 15 ++---- notmuch-restore.c | 11 ++-- notmuch-search.c | 15 ++---- notmuch-setup.c | 22 ++++---- notmuch-show.c | 15 ++---- notmuch-tag.c | 15 ++---- notmuch.c | 138 +++++++++++++++++++++++++++----------------------- test/random-corpus.c | 2 +- 13 files changed, 159 insertions(+), 217 deletions(-) -- 1.7.10.4