equal
deleted
inserted
replaced
15 |
15 |
16 _relpipe_in_jack_completion_read_nullbyte() { local IFS=; for v in "$@"; do export "$v"; read -r -d '' "$v"; done } |
16 _relpipe_in_jack_completion_read_nullbyte() { local IFS=; for v in "$@"; do export "$v"; read -r -d '' "$v"; done } |
17 |
17 |
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-jack-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" && "$output" = "true" && "$mine" = "false" ]]; then echo "$name"; fi; done |
24 fi |
24 fi |
25 } |
25 } |
36 BOOLEAN_VALUES=( |
36 BOOLEAN_VALUES=( |
37 "true" |
37 "true" |
38 "false" |
38 "false" |
39 ) |
39 ) |
40 |
40 |
41 if [[ "$w1" == "--jack-client-name" && "x$w0" == "x" ]]; then COMPREPLY=("'relpipe-in-jack'") |
41 if [[ "$w1" == "--client" && "x$w0" == "x" ]]; then COMPREPLY=("'relpipe-in-jack'") |
42 elif [[ "$w1" == "--jack-connect-to-port" ]]; then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports)" -- "$w0")) |
42 elif [[ "$w1" == "--port" && "x$w0" == "x" ]]; then COMPREPLY=("'midi-in'") |
43 elif [[ "$w1" == "--required-jack-connections" && "x$w0" == "x" ]]; then COMPREPLY=("0") |
43 elif [[ "$w1" == "--connect-to" ]]; then COMPREPLY=($(compgen -W "$(_relpipe_in_jack_completion_ports)" -- "$w0")) |
44 elif [[ "$w1" == "--list-jack-ports" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) |
44 elif [[ "$w1" == "--required-connections" && "x$w0" == "x" ]]; then COMPREPLY=("0") |
|
45 elif [[ "$w1" == "--list-ports" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) |
45 elif [[ "$w1" == "--list-midi-messages" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) |
46 elif [[ "$w1" == "--list-midi-messages" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0")) |
46 else |
47 else |
47 OPTIONS=( |
48 OPTIONS=( |
48 "--jack-client-name" |
49 "--client" |
49 "--jack-connect-to-port" |
50 "--port" |
50 "--required-jack-connections" |
51 "--connect-to" |
51 "--list-jack-ports" |
52 "--required-connections" |
|
53 "--list-ports" |
52 "--list-midi-messages" |
54 "--list-midi-messages" |
53 ) |
55 ) |
54 COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) |
56 COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) |
55 fi |
57 fi |
56 } |
58 } |