bash-completion.sh
author František Kučera <franta-hg@frantovo.cz>
Wed, 20 Apr 2022 20:59:42 +0200
branchv_0
changeset 6 65abb0376a0d
parent 3 b71fc3b5e56b
child 8 04550f271623
permissions -rw-r--r--
receive whole message, do not trim at the first 0x00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
# Relational pipes
2
1eef3d465863 update copyright year
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     2
# Copyright © 2022 František Kučera (Frantovo.cz, GlobalCode.info)
0
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
#
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
# This program is free software: you can redistribute it and/or modify
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
# it under the terms of the GNU General Public License as published by
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
# the Free Software Foundation, version 3 of the License.
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
#
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
# This program is distributed in the hope that it will be useful,
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
# GNU General Public License for more details.
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
#
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
# You should have received a copy of the GNU General Public License
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
# along with this program. If not, see <http://www.gnu.org/licenses/>.
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
_relpipe_in_posixmq_completion() {
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
	local w0 w1 w2 w3
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
	COMPREPLY=()
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
	w0=${COMP_WORDS[COMP_CWORD]}
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
	w1=${COMP_WORDS[COMP_CWORD-1]}
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
	w2=${COMP_WORDS[COMP_CWORD-2]}
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
	w3=${COMP_WORDS[COMP_CWORD-3]}
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
	DATA_TYPE=(
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
		"string"
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
		"integer"
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
		"boolean"
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
	)
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
3
b71fc3b5e56b new option: --unlink-on-close (delete the MQ file at the end)
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    31
	BOOLEAN_VALUES=(
0
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
		"true"
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
		"false"
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	)
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
3
b71fc3b5e56b new option: --unlink-on-close (delete the MQ file at the end)
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    37
	elif [[ "$w1" == "--unlink-on-close"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
1
291bdd97fcff early version, support text messages only
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    38
	elif [[ "$w1" == "--queue"                         && "x$w0" == "x" ]];    then COMPREPLY=("''")
291bdd97fcff early version, support text messages only
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    39
	elif [[ "$w1" == "--message-count"                 && "x$w0" == "x" ]];    then COMPREPLY=("1")
0
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	else
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
		OPTIONS=(
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
			"--relation"
3
b71fc3b5e56b new option: --unlink-on-close (delete the MQ file at the end)
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    43
			"--unlink-on-close"
1
291bdd97fcff early version, support text messages only
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    44
			"--queue"
291bdd97fcff early version, support text messages only
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    45
			"--message-count"
0
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
		)
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
	fi
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
}
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
e8205d9206fb new project relpipe-in-posixmq
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
complete -F _relpipe_in_posixmq_completion relpipe-in-posixmq