zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Fix getent completion
@ 2011-10-27 19:28 Mikael Magnusson
  0 siblings, 0 replies; only message in thread
From: Mikael Magnusson @ 2011-10-27 19:28 UTC (permalink / raw)
  To: zsh-workers

getent --help now looks like this:

Supported databases:
ahosts ahostsv4 ahostsv6 aliases ethers group gshadow hosts netgroup
networks passwd protocols rpc services shadow

For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

which results in completion like this:
% getent <tab>
===database
\<http://www.gnu.org/software/libc/bugs.html\>.  aliases  hosts          please     services
For                                              bug      instructions,  protocols  shadow
ahosts                                           ethers   netgroup       reporting        
ahostsv4                                         group    networks       rpc              
ahostsv6                                         gshadow  passwd         see:             

Rather than change the -1 to -3, this should still work with old versions that don't have extra lines after the databases output.

diff --git a/Completion/Unix/Command/_getent b/Completion/Unix/Command/_getent               
index 57d2ec2..9644fa3 100755
--- a/Completion/Unix/Command/_getent
+++ b/Completion/Unix/Command/_getent
@@ -25,8 +25,9 @@ case $state in
   ;;
   databases)
     if [[ $is_gnu = gnu ]]; then
-      databases=( ${=${${(f)"$(_call_program databases $words[1] --help \
-          2>/dev/null)"}[(r)Supported*,-1]}[2,-1]} )
+      databases=( "${(@)${(@f)$(_call_program databases $words[1] --help \
+                   2>/dev/null)}[(r)Supported*,-1]}" )
+      databases=( "${=${(@)databases[2,${(@)databases[(i)]}-1]}}" )
     else
       databases=( passwd group hosts ipnodes services protocols ethers networks netmasks )
     fi
-- 
1.7.5.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-27 19:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-27 19:28 PATCH: Fix getent completion Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).