Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: detect if command has a completion function
- X-seq: zsh-users 26048
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: detect if command has a completion function
- Date: Sat, 29 Aug 2020 12:27:28 -0700
- Archived-at: <https://zsh.org/users/26048>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-08/CAH%2Bw%3D7Z0RbzWv%2BmQwB_oiZq1Jx5V4n%2B6OQojm0_kxcYQg8FJaA%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-ot1-f49.google.com) smtp.remote-ip=209.85.210.49; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=skipped; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=jJvfif+BvoUNjWMHVIYFcbL+2RV/m/K1xUeFIhDG4N0=; b=ITSNmGKhdwiiqcQNpZoJyGLEtE5or2VjWhps8Y6IlQTuLCITjVs7EJ2J2sc0UEuU2m JRM9Shv0K04g7L1KMoOZ0rHLXgk/suzVhguKo9CD7Srk2O/A48q2VHHe+iQZxctu9YuV vNBVKi0F7kQwcUbEU1FgUWRA34lEIXdtnssI26b0aqZsgrlcwda1n67cMPmzASVYScuG qikQSU+qWf2dOSlb11A0SMUiPespZ2CnGtdNlDh7Ze3pOLBb4bVsUIHhlulUJXIR1CYN /uem+EFHEfVPCP6ed9vtAXKTm+I5EbIZjI42CIAYT7K+s9mLJtKJoPf0LmKCPx0j8PeI jVKQ==
- In-reply-to: <CAH+w=7Z1XwGeqmOV0ZRnkwPepisyCwUxqf-zWLRq3x_ojnw+sQ@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-users>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-users.zsh.org>
- List-owner: <mailto:zsh-users-request@zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-users>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-users>
- References: <301108111.164161.1598719628682.ref@mail.yahoo.com> <301108111.164161.1598719628682@mail.yahoo.com> <CAH+w=7Z1XwGeqmOV0ZRnkwPepisyCwUxqf-zWLRq3x_ojnw+sQ@mail.gmail.com>
- Sender: zsh-users-request@xxxxxxx
On Sat, Aug 29, 2020 at 11:33 AM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Don't bother removing the compdef lines, just remove their results.
This could be taken a step further:
all_comps=( ${(v)_comps} )
completed=( ${(k)_comps:#-*} )
installed=( ${(k)builtins} ${(k)functions} ${(k)commands} )
not_installed=( ${completed:|installed} )
unset '_comps['${^not_installed}']'
used_comps=( ${(v)_comps} )
unused_comps=( ${all_comps:|used_comps} )
unfunction ${(k)functions:*unused_comps}
(Note the tweak to completed=(...), I think -* covers what needs ignoring.)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author