diff -r 2665ab0bcf44 -r 2b57c8683ffe bash-completion.sh --- a/bash-completion.sh Sun Aug 07 10:45:05 2022 +0200 +++ b/bash-completion.sh Sun Aug 21 00:16:50 2022 +0200 @@ -22,27 +22,54 @@ w2=${COMP_WORDS[COMP_CWORD-2]} w3=${COMP_WORDS[COMP_CWORD-3]} - DATA_TYPE=( - "string" - "integer" - "boolean" + CONNECTION_STRINGS=( + "udp://127.0.0.1:64000" + "tcp://127.0.0.1:64000" + "sctp://127.0.0.1:64000" + "uds:///tmp/relpipe.socket" ) - BOOLEAN_VALUES=( - "true" - "false" + OPTIONS=( + "protocol" + "role" + "mode" + "host" + "port" + "path" + "delay" + ) + + PROTOCOLS=( + "tcp" + "udp" + "uds" + "sctp" + ) + + ROLES=( + "client" + "server" + ) + + MODES=( + "stream" + "datagram" ) if [[ "$w1" == "--relation" && "x$w0" == "x" ]]; then COMPREPLY=("''") - elif [[ "$w1" == "--unlink-on-close" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) - elif [[ "$w1" == "--queue" && "x$w0" == "x" ]]; then COMPREPLY=("''") elif [[ "$w1" == "--message-count" && "x$w0" == "x" ]]; then COMPREPLY=("1") + elif [[ "$w1" == "--connection-string" ]]; then COMPREPLY=($(compgen -W "${CONNECTION_STRINGS[*]}" -- "$w0")) + elif [[ "$w1" == "--connection-option" ]]; then COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) + elif [[ "$w2" == "--connection-option" && "$w1" == "protocol" ]]; then COMPREPLY=($(compgen -W "${PROTOCOLS[*]}" -- "$w0")) + elif [[ "$w2" == "--connection-option" && "$w1" == "role" ]]; then COMPREPLY=($(compgen -W "${ROLES[*]}" -- "$w0")) + elif [[ "$w2" == "--connection-option" && "$w1" == "mode" ]]; then COMPREPLY=($(compgen -W "${MODES[*]}" -- "$w0")) + elif [[ "$w2" == "--connection-option" && "$w1" == "path" ]]; then COMPREPLY=($(compgen -f -- "$w0")) else OPTIONS=( "--relation" - "--unlink-on-close" - "--queue" "--message-count" + "--connection-string" + "--connection-option" ) COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) fi