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