git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: "Thomas Rast" <trast@inf.ethz.ch>,
	git@vger.kernel.org, "Jonathan Nieder" <jrnieder@gmail.com>,
	"SZEDER Gábor" <szeder@ira.uka.de>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Thomas Rast" <trast@student.ethz.ch>,
	"Jeff King" <peff@peff.net>
Subject: Re: [PATCH v3 1/5] completion: simplify __gitcomp_1
Date: Sun, 15 Apr 2012 10:29:17 +0200	[thread overview]
Message-ID: <m2ehrpcs9u.fsf@linux-m68k.org> (raw)
In-Reply-To: <CAMP44s05KsZFAW=i7TvN0jDNPyFZ4OHkOTwVp2+04CR-jsz-nA@mail.gmail.com> (Felipe Contreras's message of "Sun, 15 Apr 2012 07:45:43 +0300")

Felipe Contreras <felipe.contreras@gmail.com> writes:

> However, I would like to simplify it even more:
>
> __gitcomp_1 ()
> {
> 	local c w s IFS=' '$'\t'$'\n'
> 	for c in $1; do
> 		w="$c$2"
> 		case "$w" in
> 		--*=*|*.) s="" ;;
> 		*)        s=" " ;;
> 		esac
> 		printf "%s$s\n" "$w"
> 	done
> }

Or even:

__gitcomp_1 ()
{
	local c IFS=$' \t\n'
	for c in $1; do
		c=$c$2
		case $c in
		--*=*|*.) ;;
		*)        c="$c " ;;
		esac
		printf '%s\n' "$c"
	done
}

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  reply	other threads:[~2012-04-15  8:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-14 21:42 [PATCH v3 0/5] completion: trivial cleanups and fixes Felipe Contreras
2012-04-14 21:43 ` [PATCH v3 1/5] completion: simplify __gitcomp_1 Felipe Contreras
2012-04-14 22:36   ` Thomas Rast
2012-04-14 22:54     ` Felipe Contreras
2012-04-15  4:45       ` Felipe Contreras
2012-04-15  8:29         ` Andreas Schwab [this message]
2012-04-15  9:33           ` SZEDER Gábor
2012-04-15  9:49             ` Andreas Schwab
2012-04-15 10:09               ` SZEDER Gábor
2012-04-14 21:43 ` [PATCH v3 2/5] completion: trivial simplification Felipe Contreras
2012-04-14 21:43 ` [PATCH v3 3/5] completion: add missing general options Felipe Contreras
2012-04-14 21:43 ` [PATCH v3 4/5] completion: avoid trailing space for --exec-path Felipe Contreras
2012-04-14 21:43 ` [PATCH v3 5/5] completion: fix completion after 'git --option <TAB>' Felipe Contreras
2012-04-15 13:20 ` [PATCH v3 0/5] completion: trivial cleanups and fixes Jonathan Nieder
2012-04-15 19:42   ` Felipe Contreras

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=m2ehrpcs9u.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=szeder@ira.uka.de \
    --cc=trast@inf.ethz.ch \
    --cc=trast@student.ethz.ch \
    /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).