...
All of commands which uses kafka-run-class.sh (such as kafka-topics.sh, kafka-server-start.sh, etc) accepts --version and -version to show version information.
Kafka's commands has some options of single-dash (e.g. -daemon) and double-dash (e.g. --topic), so this changes will make enable accept both option.
This option shows Kafka version and git commit hash like below:
$ kafka-topics.sh --version
(snip)
2.0.0-SNAPSHOT (Commit:152c8e88cbe00c8b)
These information are gotten from AppInfoParser#getVersion and AppInfoParser#getCommitIdIn addition to this, I think both support is helpful to find this option.
In my approach, it won't be shown up in help description, but a lot of software have version option with -version or --version.
Proposed Changes
- Add new class to show version information.
- Add code to kafka-run-class.sh to realize version option and run this class.
...
need to maintain individually for this option when anyone add and update commands
This problem may be solved by KIP-14 (Tools Standardization).
Some code will be added to kafka-run-class.sh only to add this option in this KIP. It makes easy to adapt KIP-14 because mount of code to be changed is small.
(That this code is only temporary before accepted KIP-14)
Support both single-dash and double-dash option for this option
This means users can use --version and -version to show version information. Both support makes easy to find this option.
However, tools standardization is under considering in KIP-14 now, and this option may be included.
We considered that it is too hard to keep maintain to support both --version and -version after accepted KIP-14.