# completions/comp.bash _comp_completions() { local cur prev opts COMPREPLY=() cur = "${COMP_WORDS[COMP_CWORD]}" prev = "${COMP_WORDS[COMP_CWORD-1]}" opts = "-h --help -v --version" if [[ "$cur" == -* ]]; then COMPREPLY = ( $(compgen -W "${opts}" -- "$cur")) return 0 fi if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=( $(compgen -d -- "$cur") $(compgen -f -- "$cur")) return 0 fi return 0 } complete -F _comp_completions comp