git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@debian.org>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC] CLI option parsing and usage generation for porcelains
Date: Sun, 14 Oct 2007 11:57:55 +0200	[thread overview]
Message-ID: <20071014095755.GF1198@artemis.corp> (raw)
In-Reply-To: <20071014091855.GA17397@soma>

[-- Attachment #1: Type: text/plain, Size: 3121 bytes --]

On Sun, Oct 14, 2007 at 09:18:55AM +0000, Eric Wong wrote:
> Pierre Habouzit <madcoder@debian.org> wrote:
> >   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 !
> 
> Very nice.  I worked on gitopt around summer of 2006 but never had the
> time to test it thoroughly.  It was a _lot_ more intrusive than yours
> currently is (it touched the diff + revision family of commands).
> 
> One feature I really like is automatically handling of long option
> abbreviations.  gitopt supported this at the expense of complexity
> and the aforementioned intrusivenes.  This allows automatic handling
> of the abbreviation style seen commonly in git shell scripts:
> 
>    --a|--am|--ame|--amen|--amend)  (from git-commit.sh)

  Yes, but if you do that, you can't order options in the order you
want (because of first match issues), making the help dumps hopelessly
random. I prefer exact match, especially since your shell can help you
autocomplete the proper command.

  I intend to have some magic in the parse_options module to dump the
options in a machine parseable way, so that zsh/bash completion for the
parseopt aware commands is almost trivial. (this was requested from one
of the zsh upstream developpers, and it definitely make sense).

  Note that I didn't migrated all the commands yet especially not
diff.c, We'll need a new construct for that: embedding a struct options
array into another to inherit its flags, though I'm not sure it's
enough, as a struct options right now embeds pointers to the variables
it fills, which doesn't work with the "pure" `diff_opt_parse` approach
right now. But I'm sure I'll come up with something :)

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-10-14  9:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-13 13:29 [RFC] CLI option parsing and usage generation for porcelains Pierre Habouzit
2007-10-13 14:53 ` Wincent Colaiuta
2007-10-14  9:18 ` Eric Wong
2007-10-14  9:57   ` Pierre Habouzit [this message]
2007-10-14 16:54     ` [PATCH] parse-options: Allow abbreviated options when unambiguous Johannes Schindelin
2007-10-14 18:02       ` Johannes Schindelin
2007-10-14 18:08         ` Pierre Habouzit
2007-10-14 21:01           ` Eric Wong
2007-10-14 22:12             ` Johannes Schindelin
2007-10-14 22:49               ` Eric Wong
2007-10-14 22:59                 ` git-svn and submodules, was " Johannes Schindelin
2007-10-15  7:07                   ` git-svn and submodules Benoit SIGOURE
2007-10-15 10:00                     ` Andreas Ericsson
2007-10-15 10:51                       ` Benoit SIGOURE
2007-10-15 10:14                     ` David Kastrup
2007-10-15 10:53                       ` Benoit SIGOURE
2007-10-15 16:27                         ` Andreas Ericsson
2007-10-15 14:45                     ` Karl Hasselström
2007-10-15 15:14                       ` .gitignore and svn:ignore [WAS: git-svn and submodules] Chris Shoemaker
2007-10-16  7:58                         ` Eric Wong
2007-10-16  9:43                           ` Karl Hasselström
2007-10-16 13:05                           ` Chris Shoemaker
2007-10-15 15:53                     ` git-svn and submodules Linus Torvalds
2007-10-15 16:17                       ` Performance issue with excludes (was: Re: git-svn and submodules) Benoit SIGOURE
2007-10-15 16:34                         ` Linus Torvalds
2007-10-15 16:51                           ` Benoit SIGOURE
2007-10-15 17:10                             ` Linus Torvalds
2007-10-15 17:38                               ` Benoit SIGOURE
     [not found] ` <1192282153-26684-2-git-send-email-madcoder@debian.org>
2007-10-13 14:39   ` [PATCH] Add a simple option parser Johannes Schindelin
2007-10-13 14:58     ` Pierre Habouzit
     [not found]   ` <1192282153-26684-3-git-send-email-madcoder@debian.org>
2007-10-13 14:47     ` [PATCH] Port builtin-add.c to use the new " Johannes Schindelin
2007-10-13 15:03       ` Pierre Habouzit
2007-10-13 19:22         ` Alex Riesen
2007-10-13 20:27           ` Pierre Habouzit
     [not found]     ` <1192282153-26684-4-git-send-email-madcoder@debian.org>
     [not found]       ` <1192282153-26684-5-git-send-email-madcoder@debian.org>
     [not found]         ` <1192282153-26684-6-git-send-email-madcoder@debian.org>
     [not found]           ` <1192282153-26684-7-git-send-email-madcoder@debian.org>
     [not found]             ` <1192282153-26684-8-git-send-email-madcoder@debian.org>
     [not found]               ` <1192282153-26684-9-git-send-email-madcoder@debian.org>
     [not found]                 ` <1192282153-26684-10-git-send-email-madcoder@debian.org>
2007-10-14 14:01                   ` [PATCH] Simplify usage string printing Jonas Fonseca
2007-10-14 16:26                     ` Pierre Habouzit
2007-10-13 19:16   ` [PATCH] Add a simple option parser Alex Riesen
2007-10-13 20:54     ` Pierre Habouzit
2007-10-13 22:14       ` Alex Riesen
2007-10-14  7:02         ` Pierre Habouzit
2007-10-14 14:10   ` [PATCH] Update manpages to reflect new short and long option aliases Jonas Fonseca
2007-10-14 16:26     ` Pierre Habouzit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071014095755.GF1198@artemis.corp \
    --to=madcoder@debian.org \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).