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 1EE03431FAF for ; Wed, 5 Nov 2014 12:50:14 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 VxWAGAte-jxM for ; Wed, 5 Nov 2014 12:50:06 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 84823431FAE for ; Wed, 5 Nov 2014 12:50:06 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id AFEC1100033; Wed, 5 Nov 2014 22:49:29 +0200 (EET) From: Tomi Ollila To: Michal Sojka , notmuch@notmuchmail.org Subject: Re: [PATCH v3 06/10] cli: Introduce "notmuch address" command In-Reply-To: <1415147159-19946-7-git-send-email-sojkam1@fel.cvut.cz> References: <1415147159-19946-1-git-send-email-sojkam1@fel.cvut.cz> <1415147159-19946-7-git-send-email-sojkam1@fel.cvut.cz> User-Agent: Notmuch/0.18.2+169~g5bcdd1c (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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: Wed, 05 Nov 2014 20:50:14 -0000 On Wed, Nov 05 2014, Michal Sojka wrote: > This moves address-related functionality from search command to the > new address command. The implementation shares almost all code and > some command line options. > > Options --offset and --limit were intentionally not included in the > address command, because they refer to messages numbers, which users > do not see in the output. This could confuse users because, for > example, they could see more addresses in the output that what was > specified with --limit. This functionality can be correctly > reimplemented for address subcommand later. > > Also useless values of --exclude flag were not included in the address > command. > > This was inspired by a patch from Jani Nikula. > --- > completion/notmuch-completion.bash | 42 ++++++++++++++++- > completion/notmuch-completion.zsh | 10 +++- > doc/man1/notmuch-address.rst | 89 ++++++++++++++++++++++++++++++++++++ > doc/man1/notmuch-search.rst | 20 +------- > doc/man1/notmuch.rst | 7 +-- > notmuch-client.h | 3 ++ > notmuch-search.c | 93 +++++++++++++++++++++++++++----------- > notmuch.c | 2 + > 8 files changed, 216 insertions(+), 50 deletions(-) > create mode 100644 doc/man1/notmuch-address.rst > > [ nnn lines removed ] > > + > +int > +notmuch_address_command (notmuch_config_t *config, int argc, char *argv[]) > +{ > + search_context_t *ctx = &search_context; > + int opt_index, ret; > + > + notmuch_opt_desc_t options[] = { > + { NOTMUCH_OPT_KEYWORD_FLAGS, &ctx->output, "output", 'o', > + (notmuch_keyword_t []){ { "sender", OUTPUT_SENDER }, > + { "recipients", OUTPUT_RECIPIENTS }, > + { 0, 0 } } }, > + { NOTMUCH_OPT_KEYWORD, &ctx->exclude, "exclude", 'x', > + (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE }, > + { "false", NOTMUCH_EXCLUDE_FALSE }, > + { 0, 0 } } }, > + { NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 }, > + { 0, 0, 0, 0, 0 } > + }; > + > + opt_index = parse_arguments (argc, argv, options, 1); > + if (opt_index < 0) > + return EXIT_FAILURE; > + > + if (! ctx->output) > + ctx->output = OUTPUT_SENDER | OUTPUT_RECIPIENTS; If no --output options are given, the default could be just to OUTPUT_SENDER (for the speed and as this behaviour is not documented) (this can be also addressed in later patch, provided that this functionality gets more "votes" from the community) Tomi > + > + if (_notmuch_search_prepare (ctx, config, > + argc - opt_index, argv + opt_index)) > + return EXIT_FAILURE; > + > + ret = do_search_messages (ctx); > + > + _notmuch_search_cleanup (ctx); > + > + return ret ? EXIT_FAILURE : EXIT_SUCCESS; > +}