aboutsummaryrefslogtreecommitdiff
path: root/notmuch-config.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2015-04-06 05:34:55 +0900
committerDavid Bremner <david@tethera.net>2015-06-01 07:32:54 +0200
commit447ad6b4984c71881b7f97641c77f0a39b71a991 (patch)
treefec61c03ae38f2d57a1483fe6aaf9f9ff080ac7d /notmuch-config.c
parent0018a8d787a98f80c665061daa9b0c73839d3666 (diff)
cli: add standard option processing to config, help and setup
In particular this fixes a recently encountered bug where the "--config" argument to "notmuch setup" is silently ignored, which the unpleasant consequence of overwriting the users config file.
Diffstat (limited to 'notmuch-config.c')
-rw-r--r--notmuch-config.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/notmuch-config.c b/notmuch-config.c
index 2d5c297b..93482787 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -872,8 +872,15 @@ int
notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])
{
int ret;
+ int opt_index;
- argc--; argv++; /* skip subcommand argument */
+ opt_index = notmuch_minimal_options ("config", argc, argv);
+ if (opt_index < 0)
+ return EXIT_FAILURE;
+
+ /* skip at least subcommand argument */
+ argc-= opt_index;
+ argv+= opt_index;
if (argc < 1) {
fprintf (stderr, "Error: notmuch config requires at least one argument.\n");