git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [QUERY] How do you sort completions?

From
SZEDER Gábor <szeder@ira.uka.de>
Date
May 28, 2013, 10:23 UTC
Message-ID
<20130528102303.GC2192@goldbirke>
In-Reply-To
<CAMP44s3_BBPu0WSzYyaVLbdg0dBuaV7MFgy1SMuK1C8P2vKbYg@mail.gmail.com>
Hi,
On Fri, May 24, 2013 at 08:11:00AM -0500, Felipe Contreras wrote:
> AFAIK bash needs the completions sorted, so we added some | sort |
> uniq.
Actually, it seems to sort and remove duplicates automatically:

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

So that | sort | uniq might not be necessary after all, and by removing them we could spare two fork()+exec()s.

I'm not sure all supported Bash versions behave this way, though.

Best, Gábor

Previous: Felipe ContrerasNext: SZEDER Gábor
Message 3 of 8 in “[QUERY] How do you sort completions?”
  1. Ramkumar RamachandraMay 24, 2013
  2. Felipe ContrerasMay 24, 2013
  3. SZEDER GáborMay 28, 2013
  4. SZEDER GáborMay 24, 2013
  5. Ramkumar RamachandraMay 24, 2013
  6. Antoine PelisseMay 24, 2013
  7. Ramkumar RamachandraMay 24, 2013
  8. Marc KhouzamMay 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.