zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: detect if command has a completion function
Date: Sat, 29 Aug 2020 12:27:28 -0700	[thread overview]
Message-ID: <CAH+w=7Z0RbzWv+mQwB_oiZq1Jx5V4n+6OQojm0_kxcYQg8FJaA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Z1XwGeqmOV0ZRnkwPepisyCwUxqf-zWLRq3x_ojnw+sQ@mail.gmail.com>

On Sat, Aug 29, 2020 at 11:33 AM Bart Schaefer
<schaefer@brasslantern.com> 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.)


      reply	other threads:[~2020-08-29 19:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <301108111.164161.1598719628682.ref@mail.yahoo.com>
2020-08-29 16:47 ` vapnik spaknik
2020-08-29 17:21   ` Marc Cornellà
     [not found]   ` <AM6PR02MB56389D8F9832FA6C58D8EF6E84530@AM6PR02MB5638.eurprd02.prod.outlook.com>
2020-08-29 17:38     ` vapnik spaknik
2020-08-29 18:33   ` Bart Schaefer
2020-08-29 19:27     ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Z0RbzWv+mQwB_oiZq1Jx5V4n+6OQojm0_kxcYQg8FJaA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).