+ if (opt_index < 0)
+ return -1;
+
+ /* We can't use argv here as it is sometimes NULL */
+ notmuch_process_shared_options (NULL, subcommand_name);
+ return opt_index;
+}
+
+
+struct _notmuch_client_indexing_cli_choices indexing_cli_choices = { };
+const notmuch_opt_desc_t notmuch_shared_indexing_options [] = {
+ { .opt_keyword = &indexing_cli_choices.decrypt_policy,
+ .present = &indexing_cli_choices.decrypt_policy_set, .keywords =
+ (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
+ { "true", NOTMUCH_DECRYPT_TRUE },
+ { "auto", NOTMUCH_DECRYPT_AUTO },
+ { "nostash", NOTMUCH_DECRYPT_NOSTASH },
+ { 0, 0 } },
+ .name = "decrypt" },
+ { }
+};
+
+
+notmuch_status_t
+notmuch_process_shared_indexing_options (notmuch_indexopts_t *opts)
+{
+ if (opts == NULL)
+ return NOTMUCH_STATUS_NULL_POINTER;
+
+ if (indexing_cli_choices.decrypt_policy_set) {
+ notmuch_status_t status;
+ status = notmuch_indexopts_set_decrypt_policy (opts,
+ indexing_cli_choices.decrypt_policy);
+ if (status != NOTMUCH_STATUS_SUCCESS) {
+ fprintf (stderr, "Error: Failed to set index decryption policy to %d. (%s)\n",
+ indexing_cli_choices.decrypt_policy, notmuch_status_to_string (status));
+ return status;
+ }
+ }
+ return NOTMUCH_STATUS_SUCCESS;
+}
+
+
+static const command_t commands[] = {
+ { NULL, notmuch_command, NOTMUCH_COMMAND_CONFIG_CREATE | NOTMUCH_COMMAND_CONFIG_LOAD,
+ "Notmuch main command." },
+ { "setup", notmuch_setup_command, NOTMUCH_COMMAND_CONFIG_CREATE | NOTMUCH_COMMAND_CONFIG_LOAD,
+ "Interactively set up notmuch for first use." },