From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26957 invoked by alias); 27 Oct 2011 19:28:28 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29876 Received: (qmail 27145 invoked from network); 27 Oct 2011 19:28:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.171 as permitted sender) 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= From: Mikael Magnusson To: zsh-workers@zsh.org Subject: PATCH: Fix getent completion Date: Thu, 27 Oct 2011 21:28:13 +0200 Message-Id: <1319743693-10790-1-git-send-email-mikachu@gmail.com> X-Mailer: git-send-email 1.7.5.4 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: . which results in completion like this: % getent ===database \. 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