[PATCH v6 10/14] cli: set up shared command-line arguments for indexing
David Bremner
david at tethera.net
Fri Oct 20 03:49:53 PDT 2017
Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:
> We have an indexopts structure for manipulating indexing in different
> ways, but we also have three command-line invocations that can trigger
> indexing: new, insert, and reindex.
>
> This changeset prepares a common parser that these subcommands can
> share.
>
> Note: if the deprecated crypto.gpg_path configuration option is set to
> anything other than "gpg", we ignore it (and print a warning on
> stderr, if built against gmime < 3.0).
>
> At the moment, it's just --try-decrypt, but others will likely follow.
> ---
> notmuch-client.h | 12 ++++++++++++
> notmuch.c | 39 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 51 insertions(+)
>
> diff --git a/notmuch-client.h b/notmuch-client.h
> index d17cdf01..27852360 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -495,4 +495,16 @@ void notmuch_exit_if_unmatched_db_uuid (notmuch_database_t *notmuch);
> void notmuch_process_shared_options (const char* subcommand_name);
> int notmuch_minimal_options (const char* subcommand_name,
> int argc, char **argv);
> +
> +
> +struct _notmuch_client_index_options {
> + bool try_decrypt;
> + bool try_decrypt_set;
> + notmuch_indexopts_t * opts;
> +};
> +extern struct _notmuch_client_index_options index_options;
> +extern const notmuch_opt_desc_t notmuch_index_options [];
> +notmuch_status_t
> +notmuch_process_index_options (notmuch_database_t *notmuch, notmuch_config_t *config);
> +
> #endif
> diff --git a/notmuch.c b/notmuch.c
> index 02148f2e..f83b5a6f 100644
> --- a/notmuch.c
> +++ b/notmuch.c
> @@ -96,6 +96,45 @@ int notmuch_minimal_options (const char *subcommand_name,
> return opt_index;
> }
>
> +
> +struct _notmuch_client_index_options index_options = { };
> +const notmuch_opt_desc_t notmuch_index_options [] = {
> + { .opt_bool = &index_options.try_decrypt,
> + .present = &index_options.try_decrypt_set,
> + .name = "try-decrypt" },
> + { }
> +};
> +
I can live with this if you can't think of an improvement, but I did
find it confusing how similar the following 3 names are
- notmuch_indexopts_t
- _notuch_client_index_options
- notmuch_index_options
More information about the notmuch
mailing list