]> git.notmuchmail.org Git - notmuch/blobdiff - command-line-arguments.h
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / command-line-arguments.h
index dfc808bdab7838c81746f7671ba2fa8b3b904ce9..606e5cd005f8e60326a48a7e9501263c343aaaae 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef NOTMUCH_OPTS_H
 #define NOTMUCH_OPTS_H
 
 #ifndef NOTMUCH_OPTS_H
 #define NOTMUCH_OPTS_H
 
+#include <stdbool.h>
+
 #include "notmuch.h"
 
 /*
 #include "notmuch.h"
 
 /*
@@ -17,18 +19,25 @@ typedef struct notmuch_keyword {
 typedef struct notmuch_opt_desc {
     /* One and only one of opt_* must be set. */
     const struct notmuch_opt_desc *opt_inherit;
 typedef struct notmuch_opt_desc {
     /* One and only one of opt_* must be set. */
     const struct notmuch_opt_desc *opt_inherit;
-    notmuch_bool_t *opt_bool;
+    bool *opt_bool;
     int *opt_int;
     int *opt_keyword;
     int *opt_flags;
     const char **opt_string;
     const char **opt_position;
 
     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;
 
     /* Must be set except for opt_inherit and opt_position. */
     const char *name;
 
-    /* Optional, if non-NULL, set to TRUE if the option is present. */
-    notmuch_bool_t *present;
+    /* 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;
 
     /* Must be set for opt_keyword and opt_flags. */
     const struct notmuch_keyword *keywords;
@@ -36,20 +45,20 @@ typedef struct notmuch_opt_desc {
 
 
 /*
 
 
 /*
-  This is the main entry point for command line argument parsing.
-
-  Parse command line arguments according to structure options,
-  starting at position opt_index.
-
-  All output of parsed values is via pointers in options.
-
-  Parsing stops at -- (consumed) or at the (k+1)st argument
-  not starting with -- (a "positional argument") if options contains
-  k positional argument descriptors.
-
-  Returns the index of first non-parsed argument, or -1 in case of error.
-
-*/
* This is the main entry point for command line argument parsing.
+ *
* Parse command line arguments according to structure options,
* starting at position opt_index.
+ *
* All output of parsed values is via pointers in options.
+ *
* Parsing stops at -- (consumed) or at the (k+1)st argument
* not starting with -- (a "positional argument") if options contains
* k positional argument descriptors.
+ *
* Returns the index of first non-parsed argument, or -1 in case of error.
+ *
+ */
 int
 parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);
 
 int
 parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);
 
@@ -62,12 +71,12 @@ parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int o
  */
 
 int
  */
 
 int
-parse_option (int argc, char **argv, const notmuch_opt_desc_toptions, int opt_index);
+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,
 parse_position_arg (const char *arg,
                    int position_arg_index,
-                   const notmuch_opt_desc_toptions);
+                   const notmuch_opt_desc_t *options);
 
 
 #endif
 
 
 #endif