From dafe22e7b3f743cd2134d0915431cf7658434352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 28 Jun 2022 19:20:21 +0200 Subject: [PATCH 1/2] Add basic kafkadocker command to run kafka in docker --- symlinks/bin/kafkadocker | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 symlinks/bin/kafkadocker diff --git a/symlinks/bin/kafkadocker b/symlinks/bin/kafkadocker new file mode 100755 index 0000000..8741859 --- /dev/null +++ b/symlinks/bin/kafkadocker @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# Runs commands for kafka CLI in docker +POSITIONAL=() +NETWORK=docker_default +HOST=kafka +PORT=9092 +SKIP_SERVER=0 +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + -n|--network) + NETWORK=$2 + shift # past argument + shift # past value + ;; + -h|--host) + HOST=$2 + shift # past argument + shift # past value + ;; + -p|--port) + PORT=$2 + shift # past argument + shift # past value + ;; + --no-server) + SKIP_SERVER=1 + shift # past argument + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; + esac +done + +if [ $SKIP_SERVER -eq 0 ]; then + POSITIONAL+=("--bootstrap-server $HOST:$PORT") +fi + +echo "docker run -it --rm --network $NETWORK bitnami/kafka:latest ${POSITIONAL[@]} " +docker run -it --rm --network $NETWORK bitnami/kafka:latest ${POSITIONAL[@]} From d1daa2b8038c129fec082228bd9cb147f7391892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 28 Jun 2022 19:27:16 +0200 Subject: [PATCH 2/2] Add completion for kafkadocker script --- symlinks/config/fish/completions/kafkadocker.fish | 1 + 1 file changed, 1 insertion(+) create mode 100644 symlinks/config/fish/completions/kafkadocker.fish diff --git a/symlinks/config/fish/completions/kafkadocker.fish b/symlinks/config/fish/completions/kafkadocker.fish new file mode 100644 index 0000000..c5b25a1 --- /dev/null +++ b/symlinks/config/fish/completions/kafkadocker.fish @@ -0,0 +1 @@ +complete -c kafkadocker -x -a 'connect-distributed.sh kafka-console-consumer.sh kafka-features.sh kafka-reassign-partitions.sh kafka-topics.sh zookeeper-server-stop.sh connect-mirror-maker.sh kafka-console-producer.sh kafka-get-offsets.sh kafka-replica-verification.sh kafka-transactions.sh zookeeper-shell.sh connect-standalone.sh kafka-consumer-groups.sh kafka-leader-election.sh kafka-run-class.sh kafka-verifiable-consumer.sh kafka-acls.sh kafka-consumer-perf-test.sh kafka-log-dirs.sh kafka-server-start.sh kafka-verifiable-producer.sh kafka-broker-api-versions.sh kafka-delegation-tokens.sh kafka-metadata-shell.sh kafka-server-stop.sh trogdor.sh kafka-cluster.sh kafka-delete-records.sh kafka-mirror-maker.sh kafka-storage.sh zookeeper-security-migration.sh kafka-configs.sh kafka-dump-log.sh kafka-producer-perf-test.sh kafka-streams-application-reset.sh zookeeper-server-start.sh'