#compdef xfstests.zsh function _xfstests.zsh() { _arguments \ {-c,--client}'[the client to test]: : _alternative "hosts\:hosts\: _ssh_hosts" "domains\:domains\:($(virsh list --all --name))"' \ {-g,--group}'[the xfstests group to run]: :($(_list_xfstests_groups))' \ {-k,--scratch}'[the exported scratch directory on the server]: : _files -/' \ {-p,--mountpoint}'[the directory to mount the server]: : _files -/' \ --no-scratch'[do not use a scratch mount during testing]' \ --no-server-access'[do not attempt to ssh into the server]' \ \*{-o,--options}'[mount options for all mounts]: :' \ {-r,--rdma}'[test using rdma]: :(rxe siw)' \ {-q,--scratchmnt}'[the directory to mount the scratch export]: : _files -/' \ {-s,--server}'[the server to test against]: : _alternative "hosts\:hosts\: _ssh_hosts" "domains\:domains\:($(virsh list --all --name))"' \ \*{-v,--version}+'[the nfs version to test (default=all)]: :(3 4 4.0 4.1 4.2)' \ {-x,--export}'[the exported directory on the server]: : _files -/' } function _list_xfstests_groups() { if [ ! -f /tmp/xfstests.groups.completion ]; then find $HOME/Programs/xfstests-dev -name group.list \ -exec grep -P '^\d+' '{}' \; | \ awk '{$1=""; print $0}' | \ awk -F\# '{print $1}' | \ grep -o -E '\w+' | \ sort | uniq > /tmp/xfstests.groups.completion fi cat /tmp/xfstests.groups.completion }