Re: [PATCH] cli: notmuch search --duplicate=N is only supported with --output=files

Subject: Re: [PATCH] cli: notmuch search --duplicate=N is only supported with --output=files

Date: Thu, 30 Oct 2014 08:19:53 +0000

To: Jani Nikula, notmuch@notmuchmail.org

Cc:

From: David Edmondson


This works, in so much as it doesn't allow the deranged behaviour.

Consequentially, --duplicate seems a bit useless. Unless I feed it a
single id: as an argument (in which case I could use --output=files), I
have to figure out which of the files output are duplicates of each
other and which are from different messages. How is that useful?

On Wed, Oct 29 2014, Jani Nikula wrote:
> Check the supported combination, and bail out for other combinations.
> ---
>  notmuch-search.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/notmuch-search.c b/notmuch-search.c
> index bc9be4593ecc..3bb5a7fbc885 100644
> --- a/notmuch-search.c
> +++ b/notmuch-search.c
> @@ -387,6 +387,11 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
>      if (opt_index < 0)
>  	return EXIT_FAILURE;
>  
> +    if (output != OUTPUT_FILES && dupe != -1) {
> +	fprintf (stderr, "Error: --duplicate=N is only supported with --output=files.\n");
> +	return EXIT_FAILURE;
> +    }
> +
>      switch (format_sel) {
>      case NOTMUCH_FORMAT_TEXT:
>  	format = sprinter_text_create (config, stdout);
> -- 
> 2.1.1

Thread: