Re: [PATCH] Make builtin-tag.c use parse_options.
From: Kristian Høgsberg <hidden>
Date: 2016-06-15 22:43:50
On Mon, 2007-11-12 at 14:09 +0100, Carlos Rica wrote:
2007/11/10, Junio C Hamano [off-list ref]:quoted
Carlos Rica [off-list ref] writes:
...
Then, Kristian, what are you willing to do in such case? It seems easier for me to concatenate of -m and -F options, even when both types are given. I don't know why "people" want multiple -m options, but I think that mixing -m and -F options could be interesting for them too. If someone know if this have been discussed and decided already, please give me the link.
I should be pretty easy to just append the contents of multiple fies,
even inter-mingled with -m options. We just do a callback like Johannes
just did for -m in builtin-commit.c for -F and append to the same
strbuf. strbuf_read() already appends, so the callback could look
something like:
static int opt_parse_F(const struct option *opt, const char *arg, int
unset)
{
struct strbuf *buf = opt->value;
if (!strcmp(arg, "-")) {
if (isatty(0))
fprintf(stderr, "(reading log message from
standard input)\n");
if (strbuf_read(&sb, 0, 0) < 0)
die("could not read log from standard input");
} else {
if (strbuf_read_file(&sb, logfile, 0) < 0)
die("could not read log file '%s': %s",
logfile, strerror(errno));
}
}
Shouldn't be too hard :)
Kristian