diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-07-18 21:22:40 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-07-18 22:19:31 +0300 |
commit | 947ebd62a0cc830b00f106f6fa5f0715674990a2 (patch) | |
tree | c192f58a199a8f4d33215f489d4b6e88ed3f734a /builtin | |
parent | fb7d80edcae482f4fa5d4be0227dc3054734e5f3 (diff) |
am: simplify parsing of "--[no-]keep-cr"
Command line options "--keep-cr" and its negation trigger
OPT_SET_INT_F(PARSE_OPT_NONEG) to set a variable to 1 and 0
respectively. Using OPT_SET_INT() to implement the positive variant
that sets the variable to 1 without specifying PARSE_OPT_NONEG gives
us the negative variant to set it to 0 for free.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/am.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/builtin/am.c b/builtin/am.c index 5c83f2e003..32f8671c68 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2347,12 +2347,9 @@ int cmd_am(int argc, const char **argv, const char *prefix) N_("pass -b flag to git-mailinfo"), KEEP_NON_PATCH), OPT_BOOL('m', "message-id", &state.message_id, N_("pass -m flag to git-mailinfo")), - OPT_SET_INT_F(0, "keep-cr", &keep_cr, - N_("pass --keep-cr flag to git-mailsplit for mbox format"), - 1, PARSE_OPT_NONEG), - OPT_SET_INT_F(0, "no-keep-cr", &keep_cr, - N_("do not pass --keep-cr flag to git-mailsplit independent of am.keepcr"), - 0, PARSE_OPT_NONEG), + OPT_SET_INT(0, "keep-cr", &keep_cr, + N_("pass --keep-cr flag to git-mailsplit for mbox format"), + 1), OPT_BOOL('c', "scissors", &state.scissors, N_("strip everything before a scissors line")), OPT_CALLBACK_F(0, "quoted-cr", &state.quoted_cr, N_("action"), |