#compdef -p zf* # Don't try any more completion after this. _compskip=1 # Completion for zftp builtin and zf* functions. The functions # zfcd_match and zfget_match (used for old-style completion) # need to be installed for remote file and directory completion to work. local subcom if [[ $words[1] = zftp ]]; then if [[ $CURRENT -eq 2 ]]; then compadd open params user login type ascii binary mode put \ putat get getat append appendat ls dir local remote mkdir rmdir return fi subcom=$words[2] else subcom=$words[1] fi case $subcom in *(cd|ls|dir)) # complete remote directories; we could be smarter about hiding prefixes zfcd_match $PREFIX $SUFFIX (( $#reply )) && compadd -S/ -q - $reply ;; *(get(|at)|gcp|delete|remote)) # complete remote files zfget_match $PREFIX $SUFFIX (( $#reply )) && compadd -F fignore - $reply ;; *(put(|at)|pcp)) # complete local files _files ;; *(open|anon|params)) # complete hosts: should do cleverer stuff with user names compgen -k hosts ;; *) # dunno... try ordinary completion after all. unset _compskip return 1 ;; esac