Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: detect if command has a completion function
- X-seq: zsh-users 26045
- From: Marc Cornellà <marc.cornella@xxxxxxxx>
- To: vapnik spaknik <vapniks@xxxxxxxxx>
- Subject: Re: detect if command has a completion function
- Date: Sat, 29 Aug 2020 19:21:06 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QeGuzbR51Vv1dHGnaMpX/LGw8mPEvo+GTIfwZHybbf0=; b=i8P2PxUX+DGwgwRAD1gTp+oGP2m8bapQA3DsPac2ucLkqDN2XBIBJJSVxYSA3yNck5IfiD6YCWkzwWvMRbp+rByCHLIbMnH+LZoYyMNiuDvbSrPKKnptpWQUaCuoCfqUx/Bm1qmh12cOfoSsCTAXiCVV08yvaBvkIiy07SjKEgVWo5uMecGtTysgcj5zC57l0mBVIXIWmLxGRFww/GkM0nG/O4H66ODz2Z+0ayto82g5mw9+C7vUaVe5dSBr9mMiCyyQJqcgpviU08moxPe3zYPVtPEhJUtb9LhiaRCT9qYP73lRnVdz3c7un0eJPLojka0Vpyq+0b+BX5TMLmnIkQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gQl6BO0PYI9oqLY8i6Aa1P4in2xH+g5TOCb0wZjNfkaq1STRKrvebvJNIbe+ds4Q8bw/F90ftJkO8DSjjTeaLoK6BZDJ3NUVw821bu5V6OMvKV+OHLY+hIcFIdqjcE/mAAhf7ahNGPtP7n7zkhKTegUvh7LOA9tDyR1MeXICK0yuNc+f7fL8M33pOYjX55GvPwfiqu/ZCDuYxgkNMWQPgaFMeK80nRQqN7OJZ0LWJfkzwSqpffn/Zs9k8iSFPJWUyD8rrqXLhJAXOrlJ3hWUxXHLDSzsVCo7NLhuFEKyNectT55CCdvtRYOBCSMSsuiMeH1m4VLcjszY9UJLATByIw==
- Archived-at: <https://zsh.org/users/26045>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-08/AM6PR02MB5638F3E9C716E62DD6691A3584530%40AM6PR02MB5638.eurprd02.prod.outlook.com>
- Authentication-results: zsh.org; iprev=pass (mail-oln040092073066.outbound.protection.outlook.com) smtp.remote-ip=40.92.73.66; dkim=pass header.d=live.com header.s=selector1 header.a=rsa-sha256; dmarc=skipped; arc=pass (i=1) header.s=arcselector9901 arc.oldest-pass=1 smtp.remote-ip=40.92.73.66
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QeGuzbR51Vv1dHGnaMpX/LGw8mPEvo+GTIfwZHybbf0=; b=iAQ/OA7mqhZJ0h6hp+/p1s4BJsPHg6o/DW0mbgdMRNhr/CGM6mgGU7XVlz9n0ZH7lFBkdmLTtFmJAl4ot4NQuHxhDSrGK96sImFiQ7y6dicKdolSA6LEe1eYc+FlCYjmcGNc3ruajTk3hc8mS1ss3wwffiM60lkD8bEOk8FWc6IUF/LfkhFNRDAYE9CYF107Aj1+WiWPCxfXsN2/GAT2X7op45oTfgc2anlp+HXw51Cohc2rdkeo6i+NGwQ53ahRSDt19iqjGrw6HD6BXdF8txEeOu+dE6sUZhRvlUnfDraU36Rae8gBpPl8ZP2AW1qVo2Want7BztKBCPyhYeiMyQ==
- In-reply-to: <301108111.164161.1598719628682@mail.yahoo.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>
- Sender: zsh-users-request@xxxxxxx
> how can I detect if a given command has a completion function, from within another function?
> I want to loop over many commands quickly, so I want to avoid resorting to searching directories with find if possible.
>
> The reason I need this capability is to help with a function I've written for cleaning up .zshrc files.
> I tend to collect lots of "compdef _gnu_generic cmd1 cmd2..." lines in my .zshrc, but many of the commands flagged for completion with _gnu_generic are not present on other systems where I install the same .zshrc.
You can use the `$_comps` array which controls which completion
function is assigned to a command.
For example, the completion function for `ls` is `_ls`:
$ echo $_comps[ls]
_ls
And so on
Marc
Messages sorted by:
Reverse Date,
Date,
Thread,
Author