#compdef fx _fx(){ local state _arguments \ '1: :->action'\ '*: :->folder_name' case $state in (action) _arguments '1:profiles:(s i o)' ;; (*) compadd "$@" $(echo $(find ~/Projects -type d -maxdepth 2 | sed 's/\/home\/max\/Projects\///g') | tr \\n ' ') esac } _fx "$@"