Re: [PATCH v2 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Mark Walters
Hi On Mon, 03 Nov 2014, Michal Sojka sojk...@fel.cvut.cz wrote: Now, when address related outputs are in a separate command, it makes no sense to combine multiple --output options in search command line. Using switch statement to handle different outputs is more readable than a series of if

Re: [PATCH v2 06/10] cli: Introduce notmuch address command

2014-11-04 Thread Mark Walters
On Mon, 03 Nov 2014, Michal Sojka sojk...@fel.cvut.cz 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

Re: [PATCH v2 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Mark Walters
Hi On Mon, 03 Nov 2014, Michal Sojka sojk...@fel.cvut.cz wrote: Now, when address related outputs are in a separate command, it makes no sense to combine multiple --output options in search command line. Using switch statement to handle different outputs is more readable than a series of

Re: [PATCH v2 09/10] cli: address: Add --output=count

2014-11-04 Thread Mark Walters
On Mon, 03 Nov 2014, Michal Sojka sojk...@fel.cvut.cz wrote: This output prints how many times was each address encountered during search. --- completion/notmuch-completion.bash | 2 +- completion/notmuch-completion.zsh | 2 +- doc/man1/notmuch-address.rst | 7 ++

Re: [RFC PATCH 0/2] cli: split 'notmuch address' from 'notmuch search'

2014-11-04 Thread Mark Walters
On Sat, 01 Nov 2014, Jani Nikula j...@nikula.org wrote: On Sat, 01 Nov 2014, Michal Sojka sojk...@fel.cvut.cz wrote: On Sat, Nov 01 2014, Jani Nikula wrote: On Fri, 31 Oct 2014, Michal Sojka sojk...@fel.cvut.cz wrote: This option allows to configure the criterion for duplicate address

Re: [PATCH v2 00/10] notmuch address command

2014-11-04 Thread Mark Walters
On Mon, 03 Nov 2014, Michal Sojka sojk...@fel.cvut.cz wrote: Hi all, this is v2 of notmuch address patchset. It obsoletes [1]. Don't be scared by the number of patches. Most of them are trivial refactoring. Patches 1-4 refactor the code so that notmuch search command is easier to split.

Re: [PATCH v2 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, Mark Walters wrote: Hi On Mon, 03 Nov 2014, Michal Sojka sojk...@fel.cvut.cz wrote: Now, when address related outputs are in a separate command, it makes no sense to combine multiple --output options in search command line. Using switch statement to handle different

Re: [PATCH v2 08/10] cli: address: Do not output duplicate addresses

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, David Bremner wrote: Michal Sojka sojk...@fel.cvut.cz writes: +/* Returns TRUE iff name and addr is duplicate. */ If you're revising this patch, it would be good to mention the side effect of this function. -process_address_list (const search_context_t *ctx,

Re: [PATCH v2 06/10] cli: Introduce notmuch address command

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, David Bremner wrote: Michal Sojka sojk...@fel.cvut.cz writes: +{ +local cur prev words cword split +_init_completion -s || return + +$split +case ${prev} in +--format) +COMPREPLY=( $( compgen -W json sexp text text0 -- ${cur} ) ) +

Re: [PATCH v2 06/10] cli: Introduce notmuch address command

2014-11-04 Thread David Bremner
Michal Sojka sojk...@fel.cvut.cz writes: Similarly for excludes. I'm ok with the duplication for now, and I can see an argument for not making the user chase references. What about using RST include directive [1] to include shared parts into more documents? [1]

Re: [PATCH v2 06/10] cli: Introduce notmuch address command

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, Mark Walters wrote: On Mon, 03 Nov 2014, Michal Sojka sojk...@fel.cvut.cz 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

[PATCH v3 03/10] cli: search: Convert ctx. to ctx-

2014-11-04 Thread Michal Sojka
In the next commit, notmuch_search_command will be refactored to several smaller functions. In order to simplify the next commit to verbatim move of several lines to new functions with search_context_t* argument, we convert all references to this structure to pointer dereferences. To do so we

[PATCH v3 00/10] notmuch address command

2014-11-04 Thread Michal Sojka
Hi all, this is v3 of notmuch address patchset. It obsoletes [1]. I think I addressed all comments made to v2. The diff between v2 and v3 is below. Besides this, I improved commit messages. I also tried to get rid of global variables in 6/10, but it looked ugly, because the definition of

[PATCH v3 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Michal Sojka
Now, when address related outputs are in a separate command, it makes no sense to combine multiple --output options in search command line. Using switch statement to handle different outputs is more readable than a series of if statements. --- doc/man1/notmuch-search.rst | 3 ---

[PATCH v3 05/10] cli: add support for hierarchical command line option arrays

2014-11-04 Thread Michal Sojka
From: Jani Nikula j...@nikula.org NOTMUCH_OPT_INHERIT expects a notmuch_opt_desc_t * pointer in output_var. The Unrecognized option message was moved out of parse_option() to not be emitted twice or when parsing a non-inherited option. --- command-line-arguments.c | 16 +---

[PATCH v3 10/10] cli: address: Add --filter-by option to configure address filtering

2014-11-04 Thread Michal Sojka
This option allows to configure the criterion for duplicate address filtering. Without this option, all unique combinations of name and address parts are printed. This option allows to filter the output more, for example to only contain unique address parts. --- completion/notmuch-completion.bash

[PATCH v3 02/10] cli: search: Move more variables into search_context_t

2014-11-04 Thread Michal Sojka
In order to share some command line options between search and address subcommands we need to add corresponding variables to the context structure. While we are at it, we also add notmuch_database_t to unify parameters of all do_search_* functions and to simplify subsequent commits. Otherwise,

[PATCH v3 08/10] cli: address: Do not output duplicate addresses

2014-11-04 Thread Michal Sojka
This filters out duplicate addresses from address command output. It also also adds tests for the address command. The code here is an extended version of a patch from Jani Nikula. --- doc/man1/notmuch-address.rst | 2 +- notmuch-search.c | 42 ++-

[PATCH v3 09/10] cli: address: Add --output=count

2014-11-04 Thread Michal Sojka
This output prints how many times was each address encountered during search. --- completion/notmuch-completion.bash | 2 +- completion/notmuch-completion.zsh | 2 +- doc/man1/notmuch-address.rst | 11 - notmuch-search.c | 49

[PATCH v3 04/10] cli: search: Split notmuch_search_command to smaller functions

2014-11-04 Thread Michal Sojka
In a subsequent commit, these functions will be used to share some functionality between search and address commands. --- notmuch-search.c | 155 ++- 1 file changed, 86 insertions(+), 69 deletions(-) diff --git a/notmuch-search.c

[PATCH v3 01/10] cli: search: Rename options to context

2014-11-04 Thread Michal Sojka
In the next commit the options structure will be extended by non-option variables. Therefore we need a more generic name. Just text replacement, no other changes. --- notmuch-search.c | 142 +++ 1 file changed, 71 insertions(+), 71 deletions(-)

[PATCH v3 06/10] cli: Introduce notmuch address command

2014-11-04 Thread Michal Sojka
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

[PATCH v2 00/10] "notmuch address" command

2014-11-04 Thread Michal Sojka
Hi all, this is v2 of "notmuch address" patchset. It obsoletes [1]. Don't be scared by the number of patches. Most of them are trivial refactoring. Patches 1-4 refactor the code so that "notmuch search" command is easier to split. Patch 5 is Jani's hierarchical command line parsing patch. Patch

[PATCH v2 06/10] cli: Introduce "notmuch address" command

2014-11-04 Thread Michal Sojka
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

[PATCH v2 02/10] cli: search: Move more variables into search_context_t

2014-11-04 Thread Michal Sojka
Just refactoring, no functional changes. --- notmuch-search.c | 49 ++--- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 2c47b80..3d2012b 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@

[PATCH v2 01/10] cli: search: Rename options to context

2014-11-04 Thread Michal Sojka
Just text replacement, no other changes. --- notmuch-search.c | 142 +++ 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 6345fb6..2c47b80 100644 --- a/notmuch-search.c +++

[PATCH v2 04/10] cli: search: Split notmuch_search_command to smaller functions

2014-11-04 Thread Michal Sojka
In the next commit, these functions will be used to share some functionality between search and address commands. --- notmuch-search.c | 155 ++- 1 file changed, 86 insertions(+), 69 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c

[PATCH v2 08/10] cli: address: Do not output duplicate addresses

2014-11-04 Thread Michal Sojka
This filters out duplicate addresses from address command output. It also also adds tests for the address command. The code here is an extended version of a patch from Jani Nikula. --- doc/man1/notmuch-address.rst | 2 +- notmuch-search.c | 40 -

[PATCH v2 09/10] cli: address: Add --output=count

2014-11-04 Thread Michal Sojka
This output prints how many times was each address encountered during search. --- completion/notmuch-completion.bash | 2 +- completion/notmuch-completion.zsh | 2 +- doc/man1/notmuch-address.rst | 7 ++ notmuch-search.c | 49 --

[PATCH v2 05/10] cli: add support for hierarchical command line option arrays

2014-11-04 Thread Michal Sojka
From: Jani Nikula NOTMUCH_OPT_INHERIT expects a notmuch_opt_desc_t * pointer in output_var. The "Unrecognized option" message was moved out of parse_option() to not be emitted twice or when parsing a non-inherited option. --- command-line-arguments.c | 16 +---

[PATCH v2 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Michal Sojka
Now, when address related outputs are in a separate command, it makes no sense to combine multiple --output options in search command line. Using switch statement to handle different outputs is more readable than a series of if statements. --- doc/man1/notmuch-search.rst | 3 ---

[PATCH v2 10/10] cli: address: Add --filter-by option to configure address filtering

2014-11-04 Thread Michal Sojka
This option allows to configure the criterion for duplicate address filtering. Without this option, all unique combinations of name and address parts are printed. This option allows to filter the output more, for example to only contain unique address parts. --- completion/notmuch-completion.bash

[PATCH v2 03/10] cli: search: Convert ctx. to ctx->

2014-11-04 Thread Michal Sojka
Mostly text replacement. --- notmuch-search.c | 81 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 3d2012b..6765a16 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -474,7

[PATCH v2 01/10] cli: search: Rename options to context

2014-11-04 Thread David Bremner
Michal Sojka writes: > Just text replacement, no other changes. I agree that the actual change is trivial, but the commit message could/should hint why it is being done.

[PATCH v2 03/10] cli: search: Convert ctx. to ctx->

2014-11-04 Thread David Bremner
Michal Sojka writes: > Mostly text replacement. Here I'd like to know why we are moving from a struct to a pointer to struct. It would be a bonus to hightlight any non text-replacement.

[PATCH v2 05/10] cli: add support for hierarchical command line option arrays

2014-11-04 Thread David Bremner
Michal Sojka writes: > From: Jani Nikula > > NOTMUCH_OPT_INHERIT expects a notmuch_opt_desc_t * pointer in > output_var. At the risk of bikeshedding, what about NOTMUCH_OPT_RECURSE instead of _INHERIT?

[PATCH v2 05/10] cli: add support for hierarchical command line option arrays

2014-11-04 Thread David Bremner
David Bremner writes: > Michal Sojka writes: > >> From: Jani Nikula >> >> NOTMUCH_OPT_INHERIT expects a notmuch_opt_desc_t * pointer in >> output_var. > > At the risk of bikeshedding, what about NOTMUCH_OPT_RECURSE instead of > _INHERIT? Hrm. Now that I read the next patch, I retract my

[PATCH v2 06/10] cli: Introduce "notmuch address" command

2014-11-04 Thread David Bremner
Michal Sojka writes: > +{ > +local cur prev words cword split > +_init_completion -s || return > + > +$split && > +case "${prev}" in > + --format) > + COMPREPLY=( $( compgen -W "json sexp text text0" -- "${cur}" ) ) > + return > + ;; > + --output)

[PATCH v2 08/10] cli: address: Do not output duplicate addresses

2014-11-04 Thread David Bremner
Michal Sojka writes: > > +/* Returns TRUE iff name and addr is duplicate. */ If you're revising this patch, it would be good to mention the side effect of this function. > -process_address_list (const search_context_t *ctx, InternetAddressList *list) > +process_address_list (const

[PATCH v2 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Mark Walters
Hi On Mon, 03 Nov 2014, Michal Sojka wrote: > Now, when address related outputs are in a separate command, it makes > no sense to combine multiple --output options in search command line. > Using switch statement to handle different outputs is more readable > than a series of if statements. I

[PATCH v2 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Mark Walters
> Hi > > On Mon, 03 Nov 2014, Michal Sojka wrote: >> Now, when address related outputs are in a separate command, it makes >> no sense to combine multiple --output options in search command line. >> Using switch statement to handle different outputs is more readable >> than a series of if

[PATCH v2 09/10] cli: address: Add --output=count

2014-11-04 Thread Mark Walters
On Mon, 03 Nov 2014, Michal Sojka wrote: > This output prints how many times was each address encountered during > search. > --- > completion/notmuch-completion.bash | 2 +- > completion/notmuch-completion.zsh | 2 +- > doc/man1/notmuch-address.rst | 7 ++ > notmuch-search.c

[RFC PATCH 0/2] cli: split 'notmuch address' from 'notmuch search'

2014-11-04 Thread Mark Walters
On Sat, 01 Nov 2014, Jani Nikula wrote: > On Sat, 01 Nov 2014, Michal Sojka wrote: >> On Sat, Nov 01 2014, Jani Nikula wrote: >>> On Fri, 31 Oct 2014, Michal Sojka wrote: This option allows to configure the criterion for duplicate address filtering. Without this option, all unique

[PATCH v2 00/10] "notmuch address" command

2014-11-04 Thread Mark Walters
On Mon, 03 Nov 2014, Michal Sojka wrote: > Hi all, > > this is v2 of "notmuch address" patchset. It obsoletes [1]. > > Don't be scared by the number of patches. Most of them are trivial > refactoring. Patches 1-4 refactor the code so that "notmuch search" > command is easier to split. Patch 5 is

[PATCH v2 07/10] cli: search: Convert --output to keyword argument

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, Mark Walters wrote: > Hi > > On Mon, 03 Nov 2014, Michal Sojka wrote: >> Now, when address related outputs are in a separate command, it makes >> no sense to combine multiple --output options in search command line. >> Using switch statement to handle different outputs is

[PATCH v2 06/10] cli: Introduce "notmuch address" command

2014-11-04 Thread Tomi Ollila
On Tue, Nov 04 2014, David Bremner wrote: > Michal Sojka writes: > >> +{ >> +local cur prev words cword split >> +_init_completion -s || return >> + >> +$split && >> +case "${prev}" in >> +--format) >> +COMPREPLY=( $( compgen -W "json sexp text text0" -- "${cur}" ) )

[PATCH v2 00/10] "notmuch address" command

2014-11-04 Thread Tomi Ollila
On Tue, Nov 04 2014, Michal Sojka wrote: > Hi all, > > this is v2 of "notmuch address" patchset. It obsoletes [1]. > > Don't be scared by the number of patches. Most of them are trivial > refactoring. Patches 1-4 refactor the code so that "notmuch search" > command is easier to split. Patch 5 is

[PATCH v2 08/10] cli: address: Do not output duplicate addresses

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, David Bremner wrote: > Michal Sojka writes: > >> >> +/* Returns TRUE iff name and addr is duplicate. */ > > If you're revising this patch, it would be good to mention the side > effect of this function. > >> -process_address_list (const search_context_t *ctx,

[PATCH v2 06/10] cli: Introduce "notmuch address" command

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, David Bremner wrote: > Michal Sojka writes: > >> +{ >> +local cur prev words cword split >> +_init_completion -s || return >> + >> +$split && >> +case "${prev}" in >> +--format) >> +COMPREPLY=( $( compgen -W "json sexp text text0" -- "${cur}" ) )

[PATCH v2 06/10] cli: Introduce "notmuch address" command

2014-11-04 Thread David Bremner
Michal Sojka writes: >> Similarly for excludes. I'm ok with the duplication for now, and I can >> see an argument for not making the user chase references. > > What about using RST include directive [1] to include shared parts into > more documents? > > [1] >

[PATCH v2 06/10] cli: Introduce "notmuch address" command

2014-11-04 Thread Michal Sojka
On Tue, Nov 04 2014, Mark Walters wrote: > On Mon, 03 Nov 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