# shellcheck shell=bash # shellcheck disable=SC2207 __resteasy() { local cur prev cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} case ${COMP_CWORD} in 1) local toplevel toplevel=$(find "$(resteasy --exec-path)" -name 'resteasy-*' -executable -printf '%P\n' | sed s/resteasy-//) COMPREPLY=($(compgen -W "--exec-path $toplevel" -- "$cur")) ;; *) case $prev in mount) COMPREPLY=($(compgen -W "ro" -- "$cur")) ;; prepare-drive) COMPREPLY=($(compgen -W "$(lsblk -pnro name)" -- "$cur")) ;; esac ;; esac } complete -F __resteasy resteasy