1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-17 00:31:09 +02:00
zsh/Completion/Base/_command_names
1999-08-24 09:17:41 +00:00

31 lines
768 B
Text

#compdef -command-
# The option `-e' if given as the first argument says that we should
# complete only external commands and executable files. This and a
# `-' as the first argument is then removed from the arguments.
local nm=$compstate[nmatches] ret=1 expl type=-c
if [[ "$1" = -e ]]; then
type=-m
shift
elif [[ "$1" = - ]]; then
shift
fi
# Complete jobs in implicit fg and bg
if [[ $type = -c && "$PREFIX[1]" = "%" ]]; then
_description expl job
compgen "$expl[@]" "$@" -j -P '%'
[[ nm -ne compstate[nmatches] ]] && return
fi
_description expl command
compgen "$expl[@]" "$@" $type && ret=0
if [[ nm -eq compstate[nmatches] ]]; then
_description expl 'executable file or directory'
_path_files "$expl[@]" "$@" -/g "*(*)"
else
return ret
fi