git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Stephen Boyd <bebarino@gmail.com>
Cc: git@vger.kernel.org, spearce@spearce.org,
	felipe.contreras@gmail.com, jrnieder@gmail.com
Subject: Re: [PATCH 2/2] completion: Use parse-options raw output for simple long options
Date: Tue, 17 Apr 2012 12:44:48 +0200	[thread overview]
Message-ID: <20120417104448.GE2299@goldbirke> (raw)
In-Reply-To: <1334140165-24958-3-git-send-email-bebarino@gmail.com>

Hi Stephen,

On Wed, Apr 11, 2012 at 03:29:25AM -0700, Stephen Boyd wrote:
> Now that parse-options supports generating lists of long options for any
> parse-optified git program we can remove the hand-coded lists in the
> completion script. Replace these lists with code to generate the lists
> lazily when a user tab completes that specific command.

> +__git_list_command_options ()
> +{
> +	git $@ --dump-raw-long-options
> +}

Attempting option completion for the first time for commands requiring
a repository to work (e.g. 'add', 'branch', 'checkout', etc.) outside
of a git repository produces a 'fatal: not a git repository' error.
These commands require a repository for '--dump-raw-long-options',
too, otherwise they error out in __git_list_command_options().  So at
least we'll need

  git $@ --dump-raw-long-options 2> /dev/null

to silence that error, but even then the user won't get any options.
Now, I don't think that getting a list of options is that useful at
that point, because the command will error out anyway (except when the
user explicitly specifies the paths to the repo and work tree), but
it's a side effect nonetheless, because it worked before.

Computing the long options for commands not requiring a repository
(e.g. 'clone', 'archive', 'help', etc.) works properly even for the
first time and outside of a repository.


Best,
Gábor

      parent reply	other threads:[~2012-04-17 10:44 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
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 [this message]

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=20120417104448.GE2299@goldbirke \
    --to=szeder@ira.uka.de \
    --cc=bebarino@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=spearce@spearce.org \
    /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).