bash-completion.sh
author František Kučera <franta-hg@frantovo.cz>
Wed, 27 Apr 2022 23:09:36 +0200
branchv_0
changeset 1 d7824971fd9e
parent 0 f4d7e0965055
permissions -rw-r--r--
first version of Kafka producer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
# Relational pipes
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
# Copyright © 2022 František Kučera (Frantovo.cz, GlobalCode.info)
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
#
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
# This program is free software: you can redistribute it and/or modify
f4d7e0965055 establish project
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
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
# the Free Software Foundation, version 3 of the License.
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
#
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
# This program is distributed in the hope that it will be useful,
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
# GNU General Public License for more details.
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
#
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
# You should have received a copy of the GNU General Public License
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
# along with this program. If not, see <http://www.gnu.org/licenses/>.
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
_relpipe_out_kafka_completion() {
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
	local w0 w1 w2 w3
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
	COMPREPLY=()
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
	w0=${COMP_WORDS[COMP_CWORD]}
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
	w1=${COMP_WORDS[COMP_CWORD-1]}
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
	w2=${COMP_WORDS[COMP_CWORD-2]}
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
	w3=${COMP_WORDS[COMP_CWORD-3]}
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
	DATA_TYPE=(
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
		"string"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
		"integer"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
		"boolean"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
	)
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	BOOLEAN_VALUES=(
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
		"true"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
		"false"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	)
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	if   [[ "$w1" == "--relation"                      && "x$w0" == "x" ]];    then COMPREPLY=("''")
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	elif [[ "$w1" == "--unlink-on-close"                                ]];    then COMPREPLY=($(compgen -W "${BOOLEAN_VALUES[*]}" -- "$w0"))
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	elif [[ "$w1" == "--queue"                         && "x$w0" == "x" ]];    then COMPREPLY=("''")
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	else
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
		OPTIONS=(
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
			"--relation"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
			"--unlink-on-close"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
			"--queue"
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
		)
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
		COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0"))
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
	fi
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
}
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
f4d7e0965055 establish project
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
complete -F _relpipe_out_kafka_completion relpipe-out-kafka