Skip to content

Commit

Permalink
Improved the kafka-topics utility.
Browse files Browse the repository at this point in the history
Signed-off-by: Hermann Mayer <[email protected]>
  • Loading branch information
Jack12816 committed Dec 10, 2024
1 parent 6e71a3b commit b4861d5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 3.7/build/utilities/kafka-topics
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ if [ "${1}" = '-h' -o "${1}" = '--help' ]; then
echo
echo 'List all topics/metadata of the Apache Kafka cluster.'
echo 'All additional args are passed through to kcat, see `$ kcat --help`.'
echo
echo 'Extra flags:'
echo
echo ' --names, -n Only list topic names'
exit
fi

if [ "${1}" = '--names' -o "${1}" = '-n' ]; then
shift
kcat -L ${@} | grep -oP 'topic "\K[^"]+' | LC_COLLATE=C sort
exit $?
fi

kcat -L ${@}
10 changes: 10 additions & 0 deletions 3.9/build/utilities/kafka-topics
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ if [ "${1}" = '-h' -o "${1}" = '--help' ]; then
echo
echo 'List all topics/metadata of the Apache Kafka cluster.'
echo 'All additional args are passed through to kcat, see `$ kcat --help`.'
echo
echo 'Extra flags:'
echo
echo ' --names, -n Only list topic names'
exit
fi

if [ "${1}" = '--names' -o "${1}" = '-n' ]; then
shift
kcat -L ${@} | grep -oP 'topic "\K[^"]+' | LC_COLLATE=C sort
exit $?
fi

kcat -L ${@}
10 changes: 10 additions & 0 deletions build/utilities/kafka-topics
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ if [ "${1}" = '-h' -o "${1}" = '--help' ]; then
echo
echo 'List all topics/metadata of the Apache Kafka cluster.'
echo 'All additional args are passed through to kcat, see `$ kcat --help`.'
echo
echo 'Extra flags:'
echo
echo ' --names, -n Only list topic names'
exit
fi

if [ "${1}" = '--names' -o "${1}" = '-n' ]; then
shift
kcat -L ${@} | grep -oP 'topic "\K[^"]+' | LC_COLLATE=C sort
exit $?
fi

kcat -L ${@}

0 comments on commit b4861d5

Please sign in to comment.