[PATCH/RFC] gitopt - command-line parsing enhancements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's my take at a new command-line option parser to reduce wear on my
fingers.  It handles both long and short options, permuting, automatic
abbreviations, required arguments, optional arguments, and bundling.

It doesn't use getopt or argp, so it should be easily portable to
non-GNU systems (and only uses git-isms trivially, so other programs can
use it easily, too).

I've tested everything lightly but it seems to be working well.  The
unit test was very helpful throughout.
More intensive testing, bugfixes and comments would be greatly
appreciated.

It should be pretty easy to convert other git-* programs to use gitopt,
and write shell wrappers for git.c like I did with am/checkout/commit.
I'll probably do so in a few days once my fingers recover a bit, of
course feedback and patches for bug reports/enhancements are encouraged,
too.

1 - gitopt: a new command-line option parser for git
	This adds the parser, tests, and some simple changes to
	the git.c wrapper.

2 - update-index: convert to using gitopt
3 - ls-tree: convert to gitopt
4 - ls-files: convert to using gitopt
	These three are fairly straightforward conversions.
	I was somewhat disappointed that update-index didn't take
	kindly to permuting arguments, but it's also a good example
	how to disable permuting via gitopt: a == b

5 - gitopt: convert setup_revisions(), and diff_opt_parse()
	This is a fairly intrusive change that affects several
	important programs.  All the tests still pass, so it must be
	working :)

6 - commit: allow --pretty= args to be abbreviated
	This one isn't strictly dependent on gitopt, and can be
	trivially changed to work without the parent patches.

-- 
Eric Wong
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]