]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parse-options.h
gitweb: fallback to system-wide config file if default config does not exist
[thirdparty/git.git] / parse-options.h
index a8760ac4b288a44d6404d0550b9640b49789d39d..1af62b0485f2760607b7d3bc3e0ebdca09a53ea4 100644 (file)
@@ -4,6 +4,7 @@
 enum parse_opt_type {
        /* special types */
        OPTION_END,
+       OPTION_ARGUMENT,
        OPTION_GROUP,
        /* options with no arguments */
        OPTION_BIT,
@@ -18,12 +19,14 @@ enum parse_opt_type {
 
 enum parse_opt_flags {
        PARSE_OPT_KEEP_DASHDASH = 1,
+       PARSE_OPT_STOP_AT_NON_OPTION = 2,
 };
 
 enum parse_opt_option_flags {
        PARSE_OPT_OPTARG  = 1,
        PARSE_OPT_NOARG   = 2,
        PARSE_OPT_NONEG   = 4,
+       PARSE_OPT_HIDDEN  = 8,
 };
 
 struct option;
@@ -57,6 +60,8 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
  *   PARSE_OPT_OPTARG: says that the argument is optionnal (not for BOOLEANs)
  *   PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs
  *   PARSE_OPT_NONEG: says that this option cannot be negated
+ *   PARSE_OPT_HIDDEN this option is skipped in the default usage, showed in
+ *                    the long one.
  *
  * `callback`::
  *   pointer to the callback to use for OPTION_CALLBACK.
@@ -81,6 +86,7 @@ struct option {
 };
 
 #define OPT_END()                   { OPTION_END }
+#define OPT_ARGUMENT(l, h)          { OPTION_ARGUMENT, 0, (l), NULL, NULL, (h) }
 #define OPT_GROUP(h)                { OPTION_GROUP, 0, NULL, NULL, NULL, (h) }
 #define OPT_BIT(s, l, v, h, b)      { OPTION_BIT, (s), (l), (v), NULL, (h), 0, NULL, (b) }
 #define OPT_BOOLEAN(s, l, v, h)     { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }