bash-completion.sh
branchv_0
changeset 14 cde9bb07ea0a
parent 13 326935d1bfab
child 15 463ce61415f1
equal deleted inserted replaced
13:326935d1bfab 14:cde9bb07ea0a
    18 _relpipe_in_jack_completion_ports() {
    18 _relpipe_in_jack_completion_ports() {
    19 	if type relpipe-in-jack &> /dev/null && type relpipe-out-nullbyte &> /dev/null; then
    19 	if type relpipe-in-jack &> /dev/null && type relpipe-out-nullbyte &> /dev/null; then
    20 		relpipe-in-jack --list-ports true --list-midi-messages false 2>/dev/null \
    20 		relpipe-in-jack --list-ports true --list-midi-messages false 2>/dev/null \
    21 			| relpipe-out-nullbyte \
    21 			| relpipe-out-nullbyte \
    22 			| while _relpipe_in_jack_completion_read_nullbyte "name" "input" "output" "physical" "terminal" "mine" "midi" "type"; do
    22 			| while _relpipe_in_jack_completion_read_nullbyte "name" "input" "output" "physical" "terminal" "mine" "midi" "type"; do
    23 				 if [[ "$midi" = "true" && "$output" = "true" && "$mine" = "false" ]]; then echo "$name"; fi; done
    23 				 if [[ "$midi" = "true" && "${!1}" = "true" && "$mine" = "false" ]]; then echo "$name"; fi; done
    24 	fi
    24 	fi
    25 }
    25 }
    26 
    26 
    27 _relpipe_in_jack_completion() {
    27 _relpipe_in_jack_completion() {
    28 	local w0 w1 w2 w3
    28 	local w0 w1 w2 w3
    38 		"false"
    38 		"false"
    39 	)
    39 	)
    40 
    40 
    41 	  if [[ "$w1" == "--client"                       && "x$w0" == "x" ]];    then COMPREPLY=("'relpipe-in-jack'")
    41 	  if [[ "$w1" == "--client"                       && "x$w0" == "x" ]];    then COMPREPLY=("'relpipe-in-jack'")
    42 	elif [[ "$w1" == "--port"                         && "x$w0" == "x" ]];    then COMPREPLY=("'midi-in'")
    42 	elif [[ "$w1" == "--port"                         && "x$w0" == "x" ]];    then COMPREPLY=("'midi-in'")
    43 	elif [[ "$w1" == "--connect-to"                                    ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports)" -- "$w0"))
    43 	elif [[ "$w1" == "--connect-to"                                    ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports output)" -- "$w0"))
       
    44 	elif [[ "$w1" == "--connect-ports"                                 ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports output)" -- "$w0"))
       
    45 	elif [[ "$w2" == "--connect-ports"                                 ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports input)" -- "$w0"))
       
    46 	elif [[ "$w1" == "--disconnect-ports"                              ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports output)" -- "$w0"))
       
    47 	elif [[ "$w2" == "--disconnect-ports"                              ]];    then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports input)" -- "$w0"))
    44 	elif [[ "$w1" == "--required-connections"         && "x$w0" == "x" ]];    then COMPREPLY=("0")
    48 	elif [[ "$w1" == "--required-connections"         && "x$w0" == "x" ]];    then COMPREPLY=("0")
    45 	elif [[ "$w1" == "--list-ports"                                    ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    49 	elif [[ "$w1" == "--list-ports"                                    ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    46 	elif [[ "$w1" == "--list-connections"                              ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    50 	elif [[ "$w1" == "--list-connections"                              ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    47 	elif [[ "$w1" == "--list-midi-messages"                            ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    51 	elif [[ "$w1" == "--list-midi-messages"                            ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
    48 	else
    52 	else
    49 		OPTIONS=(
    53 		OPTIONS=(
    50 			"--client"
    54 			"--client"
    51 			"--port"
    55 			"--port"
    52 			"--connect-to"
    56 			"--connect-to"
       
    57 			"--connect-ports"
       
    58 			"--disconnect-ports"
    53 			"--required-connections"
    59 			"--required-connections"
    54 			"--list-ports"
    60 			"--list-ports"
    55 			"--list-connections"
    61 			"--list-connections"
    56 			"--list-midi-messages"
    62 			"--list-midi-messages"
    57 		)
    63 		)