Make command filtering in zsh completion more robust.

- Filter out any lines that don't resemble a command in the help text.

- Fixes #1525.
This commit is contained in:
akermu 2015-09-17 19:04:39 +02:00
parent f4a124e7e2
commit f031ce581b

View file

@ -154,7 +154,7 @@ function _beet_subcmd_options()
# Now build the arguments to _regex_arguments for each subcommand.
local -a options regex_words_subcmds regex_words_help
local subcmd cmddesc
for i in ${${(f)"$(beet help | awk 'f;/Commands:/{f=1}')"[@]}[@]}
for i in ${${(f)"$(beet help | awk 'f;/Commands:/{f=1}' | grep '^ \w.*')"[@]}[@]}
do
subcmd="${i[(w)1]}"
cmddesc="${${${${${i[(w)2,-1]##\(*\) #}//:/-}//\[/(}//\]/)}//\'/}"