bash-completion.sh
branchv_0
changeset 22 eebc16b7c3e4
parent 15 b3239e4ad328
child 23 d2ad84dcf249
equal deleted inserted replaced
21:70b252d02a92 22:eebc16b7c3e4
    11 # GNU General Public License for more details.
    11 # GNU General Public License for more details.
    12 #
    12 #
    13 # You should have received a copy of the GNU General Public License
    13 # You should have received a copy of the GNU General Public License
    14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
    14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
    15 
    15 
       
    16 _relpipe_out_jack_completion_read_nullbyte() { local IFS=; for v in "$@"; do export "$v"; read -r -d '' "$v"; done }
       
    17 
    16 _relpipe_out_jack_completion_ports() {
    18 _relpipe_out_jack_completion_ports() {
    17 	# TODO: simpler and faster implementation in relpipe-out-jack or relpipe-in-jack C++ code
    19 	if type relpipe-in-jack &> /dev/null && type relpipe-out-nullbyte &> /dev/null; then
    18 	jack_lsp -tp 2>/dev/null \
    20 		relpipe-in-jack --list-jack-ports true --list-midi-messages false 2>/dev/null \
    19 		| tr -d \\t \
    21 			| relpipe-out-nullbyte \
    20 		| tr \\n \\0 \
    22 			| while _relpipe_out_jack_completion_read_nullbyte "name" "input" "output" "physical" "terminal" "mine" "midi" "type"; do
    21 		| relpipe-in-cli \
    23 				 if [[ "$midi" = "true" && "$input" = "true" && "$mine" = "false" ]]; then echo "$name"; fi; done
    22 			--relation "jack_midi_port" \
    24 	fi
    23 			--attribute "name" string \
       
    24 			--attribute "properties" string \
       
    25 			--attribute "type" string \
       
    26 			--records-on-stdin true \
       
    27 		| relpipe-tr-grep '.*' 'properties' 'input' \
       
    28 		| relpipe-tr-grep '.*' 'type' 'midi' \
       
    29 		| relpipe-tr-cut '.*' 'name' \
       
    30 		| relpipe-out-nullbyte \
       
    31 		| tr \\0 \\n
       
    32 }
    25 }
    33 
    26 
    34 _relpipe_out_jack_completion() {
    27 _relpipe_out_jack_completion() {
    35 	local w0 w1 w2 w3
    28 	local w0 w1 w2 w3
    36 
    29