Re: [PATCH] Add a simple option parser.
From: Pierre Habouzit <hidden>
Date: 2016-06-15 22:43:38
On jeu, oct 04, 2007 at 03:15:32 +0000, Pierre Habouzit wrote:
On Thu, Oct 04, 2007 at 02:57:58PM +0000, Kristian Høgsberg wrote:quoted
I'm not sure - we can go with the current proposal and add new options types and probably the callback option type I suggested as we go. I don't want to block builtin-commit on figuring out what the perfect option parser should look like and what I sent out earlier work for commit. I think the way you handled the strbuf rewrites worked pretty well; extending and rewriting the API as you put it to use in more and more places. We can do the same thing with parse_options().Of course we can do that, or junio said that some people talked about popt some time ago. I understand that you don't want to block the git-commit work, but doing things right from the beginning is often a big win on the long term. I don't know popt, and I don't know if it has sufficient expressivity. For sure I don't like getopt_long APIs at all, so if popt is as cumbersome, rolling our own based on the current parse_options you propose is probably a good choice.
Okay, popt seems to be quite complicated, and depends upon gettext (which we may require as per survey results, but right now it seems a useless dependency). Don't get me wrong, I'm sure it's very powerful, but again, I believe we can have a 200 line ad-hoc module that fits what git really needs, the less cumbersome way. So well, I'd be (I'm not in position to decide anything btw ;p) in favor of pursuing the work into git-commit like you did, and ASAP it gets merged into next, I'm definitely willing to pursue a refactoring to use it (now that strbufs seems to have been used where needed). -- ·O· Pierre Habouzit ··O madcoder@debian.org OOO http://www.madism.org
Attachments
- (unnamed) [application/pgp-signature] 189 bytes