#/usr/bin/env bash _blkar_completion() { local SUBCOM="calc check decode encode help repair rescue show sort update" if (( $COMP_CWORD == 1 )); then COMPREPLY=($(compgen -W "$SUBCOM" "${COMP_WORDS[1]}")) else if ($(compgen -W COMPREPLY=($(compgen -W "$(ls -1)" "${COMP_WORDS[$COMP_CWORD]}")) fi } complete -F _blkar_completion blkar