[
https://issues.apache.org/jira/browse/KAFKA-2111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16108936#comment-16108936
]
ASF GitHub Bot commented on KAFKA-2111:
---
GitHub user johnma14 opened a pull request:
https://github.com/apache/kafka/pull/3605
KAFKA-2111: Add help arguments and required fields
This patch addresses the less invasive standardization of command
line arguments as an offshoot of KIP-14. The following changes have
been addressed in this patchset:
- Used the required() method of JOptSimple to identify required options
for commands. Currently, an option is identified as required by
mentioning the word REQUIRED in the description of the option.
- Used the requiredIf() and requiredUnless() methods to capture option
requirements which met the condition - required if/unless some other
option is present
- Removed calls to CommandLineUtils.checkRequiredArgs(). Since we use
JOptSimple's required() function to mark options as required, when
we parse the arguments using OptionParser, it automatically checks
the required arguments in that call. So there is no need to do this
check again externally.
- Added a help option to all the commands that were missing it. For
some of the commands that had the help option, included the call to
forHelp() method to mark the option as a help option. This means that
specifying help option on the command line will not cause parsing to
fail because of missing required options.
- Added try-catch statements to correctly capture OptionException. In
the case an OptionException is caught, the command usage information
will be printed along with the exception message. The stacktrace for
all other exceptions will be printed to System.err. This addresses
the issue in KAFKA-4220
- Made some minor changes to the description text and added some more
description for some of the options
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/johnma14/kafka bug/KAFKA-2111
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/3605.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #3605
commit 97061e37a2f4f4b32fb4353d0e4d8590020225c2
Author: johnma14
Date: 2017-06-27T23:11:46Z
KAFKA-2111: Add help arguments and required fields
This patch addresses the less invasive standardization of command
line arguments as an offshoot of KIP-14. The following changes have
been addressed in this patchset:
- Used the required() method of JOptSimple to identify required options
for commands. Currently, an option is identified as required by
mentioning the word REQUIRED in the description of the option.
- Used the requiredIf() and requiredUnless() methods to capture option
requirements which met the condition - required if/unless some other
option is present
- Removed calls to CommandLineUtils.checkRequiredArgs(). Since we use
JOptSimple's required() function to mark options as required, when
we parse the arguments using OptionParser, it automatically checks
the required arguments in that call. So there is no need to do this
check again externally.
- Added a help option to all the commands that were missing it. For
some of the commands that had the help option, included the call to
forHelp() method to mark the option as a help option. This means that
specifying help option on the command line will not cause parsing to
fail because of missing required options.
- Added try-catch statements to correctly capture OptionException. In
the case an OptionException is caught, the command usage information
will be printed along with the exception message. The stacktrace for
all other exceptions will be printed to System.err. This addresses
the issue in KAFKA-4220
- Made some minor changes to the description text and added some more
description for some of the options
> Command Line Standardization - Add Help Arguments & List Required Fields
>
>
> Key: KAFKA-2111
> URL: https://issues.apache.org/jira/browse/KAFKA-2111
> Project: Kafka
> Issue Type: Improvement
> Components: admin
>Reporter: Matt Warhaftig
>Assignee: Mariam John
>Priority: Minor
> Labels: newbie
>
> KIP-14 is the standardization of tool command line arguments. As an offshoot
> of that proposal there are standardization changes that don't need to be part
> of