All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <bebarino@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, spearce@spearce.org, szeder@ira.uka.de,
	jrnieder@gmail.com
Subject: Re: [PATCH 1/2] parse-options: Add support for dumping out long options
Date: Thu, 12 Apr 2012 00:42:50 -0700	[thread overview]
Message-ID: <4F86877A.9020703@gmail.com> (raw)
In-Reply-To: <CAMP44s37wm2G0vSmtND83ghrjHHfbyCbsKEoaUew-YxE73T=6A@mail.gmail.com>

On 04/11/2012 03:51 AM, Felipe Contreras wrote:
> On Wed, Apr 11, 2012 at 1:29 PM, Stephen Boyd <bebarino@gmail.com> wrote:
>> The bash completion script wants to know what the long options are for a
>> certain command at runtime. Add a magical long option that nobody could
>> possibly ever use (--dump-raw-long-options) to get this information.
> 
> I thought about doing this, but I would like more than just dumping
> the options. In zsh one can show more than just the options; each
> option can have a description.

Cool. I don't use zsh but it sounds interesting. Perhaps the magical
long option should grow an optional argument? i.e.

	--dump-raw-long-option=zsh

which would dump the options in a format that zsh would like?

Alternatively, we can make a tiny option description grammar that's
easily parsed. I probably won't have time for this any time soon though.

> 
> I was thinking on something like 'git help --raw'. We also need
> something like that to list all the plumbing commands, and options for
> certain options, like merge strategies, and so on. Perhaps it would
> even make sense to have a new 'git raw-help' command.
> 

I'd like to avoid tying the long option stuff to git help so that other
users of parse-options besides git (perhaps perf?) get the dumping
support for free. Actually it works well for 'git notes <subcommand>'
right now so it probably has to stay tied to each git command. Plus I
think we've covered merge strategies and command lists already so I
don't know how useful 'git help --raw' would be.

I have been pondering ways to get all the possible config keys
dynamically. That would remove a huge list (~2000 lines) in the
completion script that always needs updating. Doing that would probably
require some sort of grep over all the source files and a special key
comparison function to look for (#define CONFIG_MATCH strcmp might
work). Even then I don't know how we would handle color.branch.* and
similar things. Maybe we would just do those by hand.

  reply	other threads:[~2012-04-12  7:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 10:29 [PATCH 0/2] Dynamic long options for bash completion Stephen Boyd
2012-04-11 10:29 ` [PATCH 1/2] parse-options: Add support for dumping out long options Stephen Boyd
2012-04-11 10:51   ` Felipe Contreras
2012-04-12  7:42     ` Stephen Boyd [this message]
2012-04-11 12:59   ` Jonathan Nieder
2012-04-12  7:02     ` Stephen Boyd
2012-04-11 14:06   ` SZEDER Gábor
2012-04-12  7:12     ` Stephen Boyd
2012-04-15 12:49       ` SZEDER Gábor
2012-04-15 19:23         ` Junio C Hamano
2012-04-11 10:29 ` [PATCH 2/2] completion: Use parse-options raw output for simple " Stephen Boyd
2012-04-11 13:09   ` Jonathan Nieder
2012-04-11 13:56   ` SZEDER Gábor
2012-04-17 10:44   ` SZEDER Gábor

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=4F86877A.9020703@gmail.com \
    --to=bebarino@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=spearce@spearce.org \
    --cc=szeder@ira.uka.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.