From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1956 invoked from network); 3 Mar 2021 21:40:54 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Mar 2021 21:40:54 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1614807654; b=oUCjt/KSokk8+q94LLizRvnwO8XMq7FOdEYGf4zptLFe6frB2zHMJdqB39XZmzvBljCH8lMyxR z/H2qdWtuUyePzyFXcJAeKqiidndXZz80PU13yHRK/fNKWPHL4Uy+hdzn8mXfVjF4tVaVH1XKP pCOvNSN2bMY5AhDBZtE9kV/EosFlNSLei2tEsLGulZVDH2Sp/xBLMn8UqmLfPuYAKhqTzmgGDL 37HYKs2Vg+iv+0/NdVNNV0VK6sHh0Mr/XDs0ErlMC0lI7tHmDVhqrzMqSVdRS2OiXOde4KX/wE yT7TRB0pCOcJZzlJ1NYH073wQFgbad7biz3N5aragEwIpg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (know-smtprelay-omc-3.server.virginmedia.net) smtp.remote-ip=80.0.253.67; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1614807654; bh=IuhDl2LJZ/YjbaZiizj/Uiv4EnyexP/3yMY/qx+fFi4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature: DKIM-Signature; b=ArCwuh5Tdlbz2uQTg+xZpewvt/lXPDYedJvb+HobwTE2B4CG4UuKR65fa/RbUllQDqA72CQmd1 WDazxGZHr7DfZm0Z67V5OD//YWwPOra5viSqF3dUo6UfumO979pUnftEzFY3OKUJoKCilIay1h Qq1ZgteaMePuU1KcSxhkEuMOHcRj7xFr4bdMeO+vTLV4S5K4KD9rDvi83kUHrroWFJ5bMWFJ0j uyvORBWeMmy1PEy+YL0La2c7uy3Sq76PzCF3rwAW6F/Kl6VClLkvk70fzTvlaaKYDOHKdudTlp RuyCv81UZ/2pDnQ7O/emt5QyZae1YbqgCVdWfxqsh0Mc0g==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=muGGMRlJ7cqcENVOGx8rMA/JGIa6+bCkD0PVbSEAcvo=; b=HvNu/e2r1UpQs/YE81NcoqLEkN CdNu1NIDtloLOIqFRXFan+6dDIpFHFNC74YtL3SfYW1B/rCX1ZR6FDNKbaQkDNHQJNMUbyiuMgsHm g26oafy83bF8PUinqiTR3RF1Xh2Rndedcm4LP35cvkhSeaAPu2K/r222uj7DKVRoUCumzM3DudUyv YElsGCzJn0sCbcsunV37WciuJcpwCo+s/vHTa7aTFhqB3QPg571DkUKi6vfZwg/vVlQjJiTMIef5i zZ2aaEXD1hYoBSxHdXpMSiMGnRAb6h5fnlMMLBkRCqpqCBurhYHecKQIGvmLNcsWDlAGyY7E41puh HRmrRhbg==; Received: from authenticated user by zero.zsh.org with local id 1lHZEf-000Asf-EX; Wed, 03 Mar 2021 21:40:49 +0000 Authentication-Results: zsh.org; iprev=pass (know-smtprelay-omc-3.server.virginmedia.net) smtp.remote-ip=80.0.253.67; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from know-smtprelay-omc-3.server.virginmedia.net ([80.0.253.67]:52970) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lHZEP-000AjQ-SF; Wed, 03 Mar 2021 21:40:35 +0000 Received: from pws-Zeus ([82.20.19.64]) by cmsmtp with ESMTPA id HZEOl0FqeA92sHZEOlpxKL; Wed, 03 Mar 2021 21:40:33 +0000 X-Originating-IP: [82.20.19.64] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.3 cv=UZt/tpaN c=1 sm=1 tr=0 cx=a_exe a=FYxK54AnRTbDA0SLc6W5Eg==:117 a=FYxK54AnRTbDA0SLc6W5Eg==:17 a=IkcTkHD0fZMA:10 a=4r7wtbcoyhZjM7_7h7gA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1614807633; bh=muGGMRlJ7cqcENVOGx8rMA/JGIa6+bCkD0PVbSEAcvo=; h=Subject:From:To:Date:In-Reply-To:References; b=SZLhabYL13AYxnVYb+vuAYsHOZ0y8lekIE4DhToPnc4DuEAGvpqeZfjtWfnG+FRM7 PdfrsC40Bgy6acc9Ad68pcIsGwOOStc5bW/oCmCs2uk6noM3xS1eRWwk7W2ZmwesiW pXR/ZXxHZHb5GS4wGb7+yAn1rWSrx4aNGKJhuF6G6H/yUfKrweYKhUdx3ePLFbR6I2 seX8aZufvnS+pYzxTFr5XOSh9vky4wwDrCzYwHbfm06xaaOf7/yg81TH0MiUbPa68F 7KIX+hme4u+t2Es+54EQ+s7siBEhLegfJ5KKNXAqeS7LLJxcazaj4aEAt1bWpfclOG RXwuEMMc6q/iA== Message-ID: <56eca2599980f3ae785921747e036fe830e3f03d.camel@ntlworld.com> Subject: Re: Completion script for the ctags program From: Peter Stephenson To: Jacob Gelbman , zsh-workers@zsh.org Date: Wed, 03 Mar 2021 21:40:32 +0000 In-Reply-To: References: <31598-1614116362.902856@aI-l.maGv.3QD7> <20210224142437.GC9342@tarpaulin.shahaf.local2> <20210303200215.GA11821@tarpaulin.shahaf.local2> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfE+AbBeDqYLbka8TR463L92fC9973ZcW+ksau+gULgEmYIkwjgcRpvn0dGl0kpYq/Cpelwk7tOEtXrst45pkZVy3NFLTfrMxunw294WHWBR9ybJZVJVV 2AUXtSB+XRCmGQqdXSqA6zIwJ0HdqhUWGbNy0VrW57EsEQBogXJBuL9TjzLU4LLWUYFVSDIvAJJAEQ== X-Seq: 48134 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On Wed, 2021-03-03 at 14:39 -0600, Jacob Gelbman wrote: > I got a little bit hung up on one of the points, which was what to do > about option names that can include the language such as > —alias-, —extras-, —fields-, —input-encoding-, > and many more. If I actually added what the could be, the > listing would be too long to read. I like it to just show the format > of the option, just so you can see it in the listing when you press > tab, but not overwhelm the output. I suspect this is over the over the top, but I'll send it anyway in case there are some hints here... It's starting to get complicated, but you could treat the as an argument to complete until there's a non-zero string there, then treat -alias-blah matched from the command line as the option. That's significantly more work, though, well beyond just a first pass using _arguments, but it is doable. With the version I have (Emacs), you can generate a list by running a function like the one below. That would need a version guard and also combining with the usual _call_program set up you'll see in a lot of existing functions. It doesn't work directly for the case you're after (though it could complete the language for the Emacs version) because you're talking about a different version of ctags, but it might give some ideas. pws _ctags_languages() { integer found local -a match mbegin mend ctags --help | while IFS= read -r line; do [[ $line = *"supported languages"* ]] && found=1 if (( found )); then if [[ $line = (#b)[[:space:]]##([^[:space:]]##)* ]]; then print $match[1] found=2 elif (( found == 2 )); then found=0 fi fi done }