Code

Merge branch 'jc/branch-merged'
[git.git] / parse-options.h
index f66ca352dc050bd65fdc15a7dd763b69cdec92df..bc317e7512af7a1cc86641a651ae5415d28e71c4 100644 (file)
@@ -20,6 +20,7 @@ enum parse_opt_type {
 enum parse_opt_flags {
        PARSE_OPT_KEEP_DASHDASH = 1,
        PARSE_OPT_STOP_AT_NON_OPTION = 2,
+       PARSE_OPT_KEEP_ARGV0 = 4,
 };
 
 enum parse_opt_option_flags {
@@ -27,6 +28,7 @@ enum parse_opt_option_flags {
        PARSE_OPT_NOARG   = 2,
        PARSE_OPT_NONEG   = 4,
        PARSE_OPT_HIDDEN  = 8,
+       PARSE_OPT_LASTARG_DEFAULT = 16,
 };
 
 struct option;
@@ -119,6 +121,11 @@ enum {
        PARSE_OPT_UNKNOWN,
 };
 
+/*
+ * It's okay for the caller to consume argv/argc in the usual way.
+ * Other fields of that structure are private to parse-options and should not
+ * be modified in any way.
+ */
 struct parse_opt_ctx_t {
        const char **argv;
        const char **out;
@@ -133,6 +140,10 @@ extern int parse_options_usage(const char * const *usagestr,
 extern void parse_options_start(struct parse_opt_ctx_t *ctx,
                                int argc, const char **argv, int flags);
 
+extern int parse_options_step(struct parse_opt_ctx_t *ctx,
+                             const struct option *options,
+                             const char * const usagestr[]);
+
 extern int parse_options_end(struct parse_opt_ctx_t *ctx);