我需要一种方法来列出zsh中别名,函数,变量,数组的名称(不包括主体/内容/值)。最佳情况下,其行为应类似于compgen
:
compgen -a # will list all the aliases you could run.
compgen -A function # will list all the functions you could run.
compgen -A variable # will list all the variables defined.
背景
我需要这个来开发env_parallel.zsh:https ://www.gnu.org/software/parallel/env_parallel.html
${(kM)parameters:#[[:alpha:]_][[:alnum:]_]#}
(带有extendedglob
)仅用于作为变量的参数。