aboutsummaryrefslogtreecommitdiff
path: root/Documentation/technical/api-parse-options.txt
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2009-05-07 21:45:08 +0200
committerJunio C Hamano <gitster@pobox.com>2009-05-09 00:29:47 -0700
commite0319ff5ed2b7927302389181449dcd029a26622 (patch)
tree5185c782d22d57ce359f0493bc26aa5ac5215c77 /Documentation/technical/api-parse-options.txt
parent2f4b97f91071f5060bf2da482cf8b0d70486d808 (diff)
downloadgit-e0319ff5ed2b7927302389181449dcd029a26622.tar.gz
git-e0319ff5ed2b7927302389181449dcd029a26622.tar.xz
parseopt: add OPT_NUMBER_CALLBACK
Add a way to recognize numerical options. The number is passed to a callback function as a string. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical/api-parse-options.txt')
-rw-r--r--Documentation/technical/api-parse-options.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 794194bad..beca98d75 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -170,6 +170,14 @@ There are some macros to easily define options:
`OPT_ARGUMENT(long, description)`::
Introduce a long-option argument that will be kept in `argv[]`.
+`OPT_NUMBER_CALLBACK(&var, description, func_ptr)`::
+ Recognize numerical options like -123 and feed the integer as
+ if it was an argument to the function given by `func_ptr`.
+ The result will be put into `var`. There can be only one such
+ option definition. It cannot be negated and it takes no
+ arguments. Short options that happen to be digits take
+ precedence over it.
+
The last element of the array must be `OPT_END()`.