Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Fix getent completion
- X-seq: zsh-workers 29876
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: Fix getent completion
- Date: Thu, 27 Oct 2011 21:28:13 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; bh=fLnnoOQozldC//FRdu8OLoDdK350d7hTJ5NWrU9dB94=; b=mRdqzapAR1j/9XnhChNCvdUAwJmWz4WcBgNFJUEqCI287iqag7HRcJWHx0mtknbay6 HRHR8E3vWI05Ku5TuyOPQpi6JtXAoRQDwdLcdYOUS87Bp0vMiTrxru+vwSij9+iWkxhh iYF1UbByOdMqVn0KMcbZKFTVmMvtBDZHuvnRo=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author