parseopt: add PARSE_OPT_NODASH

Add support for options that don't start with a dash.  Initially, they
don't accept arguments and can only be short options, i.e. consist of a
single character.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2009-05-07 21:45:42 +02:00
committed by Junio C Hamano
parent e0319ff5ed
commit 51a9949eda
4 changed files with 42 additions and 4 deletions

View File

@ -31,6 +31,7 @@ String options
Magic arguments
--quux means --quux
-NUM set integer to NUM
+ same as -b
Standard options
--abbrev[=<n>] use <n> digits to display SHA-1s
@ -276,6 +277,12 @@ test_expect_success 'OPT_NEGBIT() works' '
test_cmp expect output
'
test_expect_success 'OPT_BOOLEAN() with PARSE_OPT_NODASH works' '
test-parse-options + + + + + + > output 2> output.err &&
test ! -s output.err &&
test_cmp expect output
'
cat > expect <<EOF
boolean: 0
integer: 12345