From: Junio C Hamano <gitster@pobox•com>
To: Tobias Klauser <tklauser@distanz•ch>
Cc: Matthieu Moy <Matthieu.Moy@imag•fr>, git@vger•kernel.org
Subject: Re: [PATCH v2 2/4] stripspace: Use parse-options for command-line parsing
Date: Fri, 16 Oct 2015 10:29:35 -0700 [thread overview]
Message-ID: <xmqqd1weg1s0.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqqoafyg2sp.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Fri, 16 Oct 2015 10:07:34 -0700")
Junio C Hamano <gitster@pobox•com> writes:
>> - if (mode == INVAL)
>> - usage(usage_msg);
>
> When given "git stripspace -s blorg", we used to set mode to INVAL
> and then showed the correct usage. But we no longer have a check
> that corresponds to the old INVAL thing, do we? Perhaps check argc
> to detect presence of an otherwise ignored non-option argument
> immediately after parse_options() returns?
Perhaps like this.
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index ac1ab3d..a8b7a93 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -40,8 +40,9 @@ int cmd_stripspace(int argc, const char **argv, const char *prefix)
OPT_END()
};
- argc = parse_options(argc, argv, prefix, options, stripspace_usage,
- PARSE_OPT_KEEP_DASHDASH);
+ argc = parse_options(argc, argv, prefix, options, stripspace_usage, 0);
+ if (argc)
+ usage_with_options(stripspace_usage, options);
if (mode == STRIP_COMMENTS || mode == COMMENT_LINES)
git_config(git_default_config, NULL);
next prev parent reply other threads:[~2015-10-16 17:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 15:16 [PATCH v2 0/4] stripspace: Implement and use --count-lines option Tobias Klauser
2015-10-16 15:16 ` [PATCH v2 1/4] strbuf: make stripspace() part of strbuf Tobias Klauser
2015-10-16 15:16 ` [PATCH v2 2/4] stripspace: Use parse-options for command-line parsing Tobias Klauser
2015-10-16 17:07 ` Junio C Hamano
2015-10-16 17:29 ` Junio C Hamano [this message]
2015-10-17 10:31 ` Tobias Klauser
2015-10-17 21:24 ` Junio C Hamano
2015-10-20 8:48 ` Tobias Klauser
2015-10-20 15:47 ` Junio C Hamano
2015-10-17 10:30 ` Tobias Klauser
2015-10-16 15:16 ` [PATCH v2 3/4] stripspace: Implement --count-lines option Tobias Klauser
2015-10-17 23:57 ` Eric Sunshine
2015-10-18 17:18 ` Junio C Hamano
2015-10-19 13:46 ` Tobias Klauser
2015-10-19 17:03 ` Christian Couder
2015-10-19 19:24 ` Eric Sunshine
2015-10-19 19:42 ` Matthieu Moy
2015-10-19 13:31 ` Tobias Klauser
2015-10-16 15:16 ` [PATCH v2 4/4] git rebase -i: Use newly added --count-lines option for stripspace Tobias Klauser
2015-10-16 16:41 ` [PATCH v2 0/4] stripspace: Implement and use --count-lines option Junio C Hamano
2015-10-17 10:27 ` Tobias Klauser
2015-10-16 16:54 ` Matthieu Moy
2015-10-17 10:28 ` Tobias Klauser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqd1weg1s0.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=Matthieu.Moy@imag$(echo .)fr \
--cc=git@vger$(echo .)kernel.org \
--cc=tklauser@distanz$(echo .)ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox