Some better parse-options documentation.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pierre Habouzit committed
Nov 5, 2007 at 13:03 UTC
9b3beb581216fc89972e926574b9d3b243d5e4f4
1 file changed
+35
-2
parse-options.h
+35
-2
@@ -22,6 +22,41 @@ enum parse_opt_option_flags {
22
struct option;
23
typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
24
25
+/*
26
+ * `type`::
27
+ * holds the type of the option, you must have an OPTION_END last in your
28
+ * array.
29
+ *
30
+ * `short_name`::
31
+ * the character to use as a short option name, '\0' if none.
32
+ *
33
+ * `long_name`::
34
+ * the long option name, without the leading dashes, NULL if none.
35
+ *
36
+ * `value`::
37
+ * stores pointers to the values to be filled.
38
+ *
39
+ * `argh`::
40
+ * token to explain the kind of argument this option wants. Keep it
41
+ * homogenous across the repository.
42
+ *
43
+ * `help`::
44
+ * the short help associated to what the option does.
45
+ * Must never be NULL (except for OPTION_END).
46
+ * OPTION_GROUP uses this pointer to store the group header.
47
+ *
48
+ * `flags`::
49
+ * mask of parse_opt_option_flags.
50
+ * PARSE_OPT_OPTARG: says that the argument is optionnal (not for BOOLEANs)
51
+ * PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs
52
+ *
53
+ * `callback`::
54
+ * pointer to the callback to use for OPTION_CALLBACK.
55
+ *
56
+ * `defval`::
57
+ * default value to fill (*->value) with for PARSE_OPT_OPTARG.
58
+ * CALLBACKS can use it like they want.
59
+ */
60
struct option {
61
enum parse_opt_type type;
62
int short_name;
@@ -32,8 +67,6 @@ struct option {
67
68
int flags;
69
parse_opt_cb *callback;
35
- /* holds default value for PARSE_OPT_OPTARG,
36
- though callbacks can use it like they want */
70
intptr_t defval;
71
};
72