From: Stephen Boyd <bebarino@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] format-patch: Add --cover-letter-wrap
Date: Wed, 01 Jul 2009 23:45:08 -0700 [thread overview]
Message-ID: <4A4C5774.9050905@gmail.com> (raw)
In-Reply-To: <5035332845f173ac9c236a90621ca04ea6633b10.1246404999.git.joe@perches.com>
Joe Perches wrote:
> @@ -792,6 +806,27 @@ static int output_directory_callback(const struct option *opt, const char *arg,
> return 0;
> }
>
> +static int cls_callback(const struct option *opt, const char *arg, int unset)
> +{
> + if (unset)
> + cls.cover_letter_wrap = 0;
> + else {
> + int i1, i2, i3;
> + if (!arg)
> + return 1;
> + int arg_count = sscanf(arg, "%d,%d,%d", &i1, &i2, &i3);
> + if (arg_count <= 0)
> + return 1;
> + if (arg_count >= 1)
> + cls.cover_letter_wrappos = i1;
> + if (arg_count >= 2)
> + cls.cover_letter_indent1 = i2;
> + if (arg_count >= 3)
> + cls.cover_letter_indent2 = i3;
> + }
This bracket is one indent off.
I'm not sure, but can this be simplified to just setting the struct
members directly through sscanf? You won't need to have these if's in
that case. I think something like --cover-letter-wrap="" would be
equivalent to just using the defaults and not an error. Does that sound
right?
> + return 0;
> +}
> +
> static int thread_callback(const struct option *opt, const char *arg, int unset)
> {
> int *thread = (int *)opt->value;
> @@ -875,6 +910,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
> "print patches to standard out"),
> OPT_BOOLEAN(0, "cover-letter", &cover_letter,
> "generate a cover letter"),
> + { OPTION_CALLBACK, 0, "cover-letter-wrap", &cls, NULL,
> + "control the cover letter format",
> + PARSE_OPT_OPTARG, cls_callback },
Why is this PARSE_OPT_OPTARG? I only see the choice of having arguments
or prefixed with a --no. Also, please use PARSE_OPT_LITERAL_ARGHELP and
give it the help string you use in the docs
(<width>[,<indent1>[,<indent2>]]).
prev parent reply other threads:[~2009-07-02 6:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 23:40 [PATCH 0/2] format-patch and send-email Joe Perches
2009-06-30 23:40 ` [PATCH 1/2] git-send-email.perl: Don't add header "In-Reply-To:" when --no-chain-reply-to set Joe Perches
2009-07-01 6:18 ` Markus Heidelberg
2009-07-01 6:27 ` Joe Perches
2009-07-01 16:59 ` Markus Heidelberg
2009-07-01 17:25 ` Joe Perches
2009-06-30 23:40 ` [PATCH 2/2] format-patch: Add --cover-letter-wrap Joe Perches
2009-07-02 6:45 ` Stephen Boyd [this message]
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=4A4C5774.9050905@gmail.com \
--to=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=joe@perches.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).