aboutsummaryrefslogtreecommitdiff
path: root/command-line-arguments.h
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2018-02-04 15:33:34 -0500
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2018-02-04 15:33:34 -0500
commitd9be1028d47cb7e98b474df420858a690798810b (patch)
treefb37f83ca098129a5301ef141dc6a5007a0972a9 /command-line-arguments.h
parenta8fb877ad7e960d69ec10887ff79e24bb99c587c (diff)
parent3c4e64d976eb561ac5157df1bbe5882e3e65b583 (diff)
Merge tag 'debian/0.26-1' into debian/stretch-backports
notmuch Debian 0.26-1 upload (same as 0.26)
Diffstat (limited to 'command-line-arguments.h')
-rw-r--r--command-line-arguments.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/command-line-arguments.h b/command-line-arguments.h
index 4c4d240e..f722f97d 100644
--- a/command-line-arguments.h
+++ b/command-line-arguments.h
@@ -1,18 +1,9 @@
#ifndef NOTMUCH_OPTS_H
#define NOTMUCH_OPTS_H
-#include "notmuch.h"
+#include <stdbool.h>
-enum notmuch_opt_type {
- NOTMUCH_OPT_END = 0,
- NOTMUCH_OPT_INHERIT, /* another options table */
- NOTMUCH_OPT_BOOLEAN, /* --verbose */
- NOTMUCH_OPT_INT, /* --frob=8 */
- NOTMUCH_OPT_KEYWORD, /* --format=raw|json|text */
- NOTMUCH_OPT_KEYWORD_FLAGS, /* the above with values OR'd together */
- NOTMUCH_OPT_STRING, /* --file=/tmp/gnarf.txt */
- NOTMUCH_OPT_POSITION /* notmuch dump pos_arg */
-};
+#include "notmuch.h"
/*
* Describe one of the possibilities for a keyword option
@@ -24,22 +15,31 @@ typedef struct notmuch_keyword {
int value;
} notmuch_keyword_t;
-/*
- * Describe one option.
- *
- * First two parameters are mandatory.
- *
- * name is mandatory _except_ for positional arguments.
- *
- * arg_id is currently unused, but could define short arguments.
- *
- * keywords is a (possibly NULL) pointer to an array of keywords
- */
+/* Describe one option. */
typedef struct notmuch_opt_desc {
- enum notmuch_opt_type opt_type;
- void *output_var;
+ /* One and only one of opt_* must be set. */
+ const struct notmuch_opt_desc *opt_inherit;
+ bool *opt_bool;
+ int *opt_int;
+ int *opt_keyword;
+ int *opt_flags;
+ const char **opt_string;
+ const char **opt_position;
+
+ /* for opt_keyword only: if no matching arguments were found, and
+ * keyword_no_arg_value is set, then use keyword_no_arg_value instead. */
+ const char *keyword_no_arg_value;
+
+ /* Must be set except for opt_inherit and opt_position. */
const char *name;
- int arg_id;
+
+ /* Optional, if non-NULL, set to true if the option is present. */
+ bool *present;
+
+ /* Optional, allow empty strings for opt_string. */
+ bool allow_empty;
+
+ /* Must be set for opt_keyword and opt_flags. */
const struct notmuch_keyword *keywords;
} notmuch_opt_desc_t;
@@ -73,7 +73,7 @@ parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int o
int
parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);
-notmuch_bool_t
+bool
parse_position_arg (const char *arg,
int position_arg_index,
const notmuch_opt_desc_t* options);