#/usr/bin/env bash WG_DOCKER_PROFILE_PATH="/opt/wg-docker/profiles" _wg-docker_completions() { local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" opts="firefox shell thunderbird up" if [[ ${cur} == * ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) local sub_opts="$(ls $WG_DOCKER_PROFILE_PATH)" case "$prev" in firefox|shell|thunderbird|up) COMPREPLY=( $(compgen -W "${sub_opts}" -- ${cur}) ) return 0 ;; version) esac fi } complete -F _wg-docker_completions wg-docker