The --entire-thread default depends on other arguments, so we'll have
to figure out if it was explicitly set by the user or not. The arg
parser .present feature helps us clean up the code here.
};
int format = NOTMUCH_FORMAT_NOT_SPECIFIED;
int exclude = TRUE;
};
int format = NOTMUCH_FORMAT_NOT_SPECIFIED;
int exclude = TRUE;
-
- /* This value corresponds to neither true nor false being passed
- * on the command line */
- int entire_thread = -1;
+ notmuch_bool_t entire_thread_set = FALSE;
notmuch_bool_t single_message;
notmuch_opt_desc_t options[] = {
notmuch_bool_t single_message;
notmuch_opt_desc_t options[] = {
{ 0, 0 } } },
{ .opt_int = ¬much_format_version, .name = "format-version" },
{ .opt_bool = &exclude, .name = "exclude" },
{ 0, 0 } } },
{ .opt_int = ¬much_format_version, .name = "format-version" },
{ .opt_bool = &exclude, .name = "exclude" },
- { .opt_bool = &entire_thread, .name = "entire-thread" },
+ { .opt_bool = ¶ms.entire_thread, .name = "entire-thread",
+ .present = &entire_thread_set },
{ .opt_int = ¶ms.part, .name = "part" },
{ .opt_bool = ¶ms.crypto.decrypt, .name = "decrypt" },
{ .opt_bool = ¶ms.crypto.verify, .name = "verify" },
{ .opt_int = ¶ms.part, .name = "part" },
{ .opt_bool = ¶ms.crypto.decrypt, .name = "decrypt" },
{ .opt_bool = ¶ms.crypto.verify, .name = "verify" },
/* Default is entire-thread = FALSE except for format=json and
* format=sexp. */
/* Default is entire-thread = FALSE except for format=json and
* format=sexp. */
- if (entire_thread != FALSE && entire_thread != TRUE) {
- if (format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP)
- params.entire_thread = TRUE;
- else
- params.entire_thread = FALSE;
- } else {
- params.entire_thread = entire_thread;
- }
+ if (! entire_thread_set &&
+ (format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP))
+ params.entire_thread = TRUE;
if (!params.output_body) {
if (params.part > 0) {
if (!params.output_body) {
if (params.part > 0) {