Re: [RFC PATCH v2 1/3] cli: notmuch-show changes to support pick

Subject: Re: [RFC PATCH v2 1/3] cli: notmuch-show changes to support pick

Date: Sun, 12 Feb 2012 22:08:23 +0100

To: Mark Walters, notmuch@notmuchmail.org

Cc:

From: Daniel Schoepe


On Sun, 12 Feb 2012 18:49:37 +0000, Mark Walters <markwalters1009@gmail.com> wrote:
> +    int opt_index, ret, entire_thread;
> +    notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;
>      const notmuch_show_format_t *format = &format_text;
>      notmuch_show_params_t params = { .part = -1 };
>      int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
>      notmuch_bool_t verify = FALSE;
> +    notmuch_bool_t headers_only = FALSE;
>  
>      notmuch_opt_desc_t options[] = {
>  	{ NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
> @@ -1042,10 +1093,19 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
>  				  { "mbox", NOTMUCH_FORMAT_MBOX },
>  				  { "raw", NOTMUCH_FORMAT_RAW },
>  				  { 0, 0 } } },
> +	{ NOTMUCH_OPT_KEYWORD, &sort, "sort", 's',
> +	  (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
> +				  { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
> +				  { 0, 0 } } },
>  	{ NOTMUCH_OPT_INT, &params.part, "part", 'p', 0 },
> -	{ NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },
> +	{ NOTMUCH_OPT_KEYWORD, &entire_thread, "thread", 't',
> +	  (notmuch_keyword_t []){ { "match", NOTMUCH_SHOW_THREAD_MATCH, },
> +				  { "entire", NOTMUCH_SHOW_THREAD_ENTIRE },
> +				  { "none", NOTMUCH_SHOW_THREAD_NONE },
> +				  { 0, 0 } } },
>  	{ NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },
>  	{ NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
> +	{ NOTMUCH_OPT_BOOLEAN, &headers_only, "headers-only", 'h', 0 },
>  	{ 0, 0, 0, 0, 0 }
>      };
>  
> @@ -1055,6 +1115,9 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
>  	return 1;
>      }
>  
> +    params.entire_thread = entire_thread;

entire_thread is not initialized here, if there is no --thread
argument. The rest of the code makes this result in the same behavior as
--thread=entire, but it should be initialized to
NOTMUCH_SHOW_THREAD_MATCH.

Cheers,
Daniel
part-000.sig (application/pgp-signature)

Thread: