All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Stephen Boyd <bebarino@gmail.com>
Cc: git@vger.kernel.org, spearce@spearce.org, szeder@ira.uka.de,
	felipe.contreras@gmail.com
Subject: Re: [PATCH 2/2] completion: Use parse-options raw output for simple long options
Date: Wed, 11 Apr 2012 08:09:24 -0500	[thread overview]
Message-ID: <20120411130924.GD3161@burratino> (raw)
In-Reply-To: <1334140165-24958-3-git-send-email-bebarino@gmail.com>

Stephen Boyd wrote:

> Is there some way to compute these lists with some magical function instead
> of duplicating that logic over and over?

Maybe roughly like this.

	for command in $porcelain
	do
		eval "__git_${command//-/_}_options="
	done
	__git_complete_for_command ()
	{
		local options
		local options_var="__git_${command//-/_}_options"

		eval "options=\$$options_var"
		if test -z "$options"
		then
			eval "$options_var=\$(__git_list_command_options \$command)"
			eval "options=\$$options_var"
		fi

		...
	}

	_git () {
		...
		__git_complete_for_command "$command"
	}

Jonathan

  reply	other threads:[~2012-04-11 13:09 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 [this message]
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=20120411130924.GD3161@burratino \
    --to=jrnieder@gmail.com \
    --cc=bebarino@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --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.