]> asedeno.scripts.mit.edu Git - git.git/blobdiff - parse-options.h
parse-opt: fake short strings for callers to believe in.
[git.git] / parse-options.h
index 72027f3c66ef7df0fe18002887a03e24af571ca0..aeed627e9757df03df94a2c93bbd8112f4bb9a2c 100644 (file)
@@ -113,6 +113,17 @@ extern NORETURN void usage_with_options(const char * const *usagestr,
 
 /*----- incremantal advanced APIs -----*/
 
+enum {
+       PARSE_OPT_HELP = -1,
+       PARSE_OPT_DONE,
+       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;
@@ -121,9 +132,16 @@ struct parse_opt_ctx_t {
        int flags;
 };
 
+extern int parse_options_usage(const char * const *usagestr,
+                              const struct option *opts);
+
 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);