Hi Jeff,
On Wed, 20 Jul 2016, Jeff Hostetler wrote:
> On 07/20/2016 11:08 AM, Johannes Schindelin wrote:
> > On Tue, 19 Jul 2016, Jeff Hostetler wrote:
> > > @@ -1336,9 +1347,9 @@ int cmd_status(int argc, const char **argv, const
> > > char *prefix)
> > > N_("show status concisely"), STATUS_FORMAT_SHORT),
> > > OPT_BOOL('b', "branch", &s.show_branch,
> > > N_("show branch information")),
> > > - OPT_SET_INT(0, "porcelain", &status_format,
> > > - N_("machine-readable output"),
> > > - STATUS_FORMAT_PORCELAIN),
> > > + { OPTION_CALLBACK, 0, "porcelain", &status_format,
> > > + N_("version"), N_("machine-readable output"),
> > > + PARSE_OPT_OPTARG, opt_parse_porcelain },
> >
> > How about using a COUNTUP here instead? We could then set the status
> > format afterwards, like this:
> >
> > if (porcelain == 0)
> > status_format = STATUS_FORMAT_UNSPECIFIED;
> > else {
> > status_format = STATUS_FORMAT_PORCELAIN;
> > if (porcelain > 1)
> > warning("No porcelain v%d; falling back to v1",
> > porcelain);
> > }
> >
>
> Maybe I misread the COUNTUP docs, but it looked like it would
> allow "--porcelain --porcelain", but not "--porcelain=2".
Whoops, you're right. It is *I* who misread the code (I did not bother
looking for the docs ;-))
Still, I would prefer to avoid that callback. IOW something like
{ OPTION_INTEGER, 0, "porcelain", &status_format,
N_("version"), N_("machine-readable output"),
PARSE_OPT_OPTARG, NULL, 1 },
followed by the if () outlined above.
Ciao,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html