Git development
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [QUERY] How do you sort completions?
Date: Fri, 24 May 2013 18:12:43 +0200	[thread overview]
Message-ID: <20130524161243.GB2104@goldbirke> (raw)
In-Reply-To: <CALkWK0k=nVHOBe5SgRH9xQK1+yAYBzbNMqsWxhYPo0MTZPp63g@mail.gmail.com>

Hi,


On Fri, May 24, 2013 at 05:03:27PM +0530, Ramkumar Ramachandra wrote:
> I'm not able to sort completions for some weird reason.  No matter
> what I order I insert stuff into COMPREPLY, bash seems to auto-sort
> them lexically.  I tried to pass --sort='-committerdate' to git
> for-each-ref so I can get a sensible 'git checkout <TAB>' reply, and
> I'm very annoyed that it doesn't work.
> 
> I thought it was bash's complete builtin doing the implicit sorting,
> so I read the manual with no success.  Is readline doing it?  If so,
> why am I not getting the ordering even in zsh (which doesn't use
> readline)?

The order of elements in COMPREPLY doesn't matter, it will be sorted
anyway:

$ _foo () { COMPREPLY=("foo" "bar" "baz") ; }
$ complete -F _foo foo
$ foo <TAB>
bar  baz  foo

I don't know who does the sorting (Bash or readline), and I don't know
any way to disable it.


Gábor

  parent reply	other threads:[~2013-05-24 16:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 11:33 [QUERY] How do you sort completions? Ramkumar Ramachandra
2013-05-24 13:11 ` Felipe Contreras
2013-05-28 10:23   ` SZEDER Gábor
2013-05-24 16:12 ` SZEDER Gábor [this message]
2013-05-24 16:18   ` Ramkumar Ramachandra
2013-05-24 16:22     ` Antoine Pelisse
2013-05-24 18:26       ` Ramkumar Ramachandra
2013-05-24 18:20     ` Marc Khouzam

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=20130524161243.GB2104@goldbirke \
    --to=szeder@ira.uka.de \
    --cc=artagnon@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.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