[RFC] CLI option parsing and usage generation for porcelains
- From
Pierre Habouzit <madcoder@debian.org>
- Date
- Oct 13, 2007, 13:29 UTC
- Message-ID
- <1192282153-26684-1-git-send-email-madcoder@debian.org>
Following Kristian momentum, I've reworked his parse_option module quite a lot, and now have some quite interesting features. The series is available from git://git.madism.org/git.git (branch ph/strbuf).
The following series is open for comments, it's not 100% ready for inclusion IMHO, as some details may need to be sorted out first, and that I've not re-read the patches thoroughly yet. Though I uses the tip of that branch as my everyday git for 2 weeks or so without any noticeable issues.
And as examples are always easier to grok:
$ git fetch -h usage: git-fetch [options] [<repository> <refspec>...]
-q, --quiet be quiet -v, --verbose be verbose
-a, --append append in .git/FETCH_HEAD -f, --force force non fast-forwards updates --no-tags don't follow tags at all -t, --tags fetch all tags --depth <depth> deepen history of a shallow clone
Advanced Options -k, --keep keep downloaded pack -u, --update-head-ok allow to update the head in the current branch --upload-pack <path> path to git-upload-pack on the remote
$ git rm -rf xdiff # yeah -rf now works ! rm 'xdiff/xdiff.h' rm 'xdiff/xdiffi.c' rm 'xdiff/xdiffi.h' rm 'xdiff/xemit.c' rm 'xdiff/xemit.h' rm 'xdiff/xinclude.h' rm 'xdiff/xmacros.h' rm 'xdiff/xmerge.c' rm 'xdiff/xprepare.c' rm 'xdiff/xprepare.h' rm 'xdiff/xtypes.h' rm 'xdiff/xutils.c' rm 'xdiff/xutils.h'