Skip to content

Commit

Permalink
[Issue 3409] Support '--help' option of Pulsar command-line tools (ap…
Browse files Browse the repository at this point in the history
…ache#3410)

* Support '--help' option of Pulsar command-line tools.

* Fix a indentation

* Fix a minor bug
  • Loading branch information
murong00 authored and merlimat committed Feb 22, 2019
1 parent 4376c65 commit c0ffa16
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/bookkeeper
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ elif [ $COMMAND == "upgrade" ]; then
elif [ $COMMAND == "shell" ]; then
ENTRY_FORMATTER_ARG="-DentryFormatterClass=${ENTRY_FORMATTER_CLASS:-org.apache.bookkeeper.util.StringEntryFormatter}"
exec $JAVA $OPTS $ENTRY_FORMATTER_ARG org.apache.bookkeeper.bookie.BookieShell -conf $BOOKIE_CONF $@
elif [ $COMMAND == "help" ]; then
elif [ $COMMAND == "help" -o $COMMAND == "--help" -o $COMMAND == "-h" ]; then
bookkeeper_help;
else
exec $JAVA $OPTS $COMMAND $@
Expand Down
2 changes: 1 addition & 1 deletion bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ elif [ $COMMAND == "sql-worker" ]; then
exec ${PRESTO_HOME}/bin/launcher --etc-dir ${PULSAR_PRESTO_CONF} "${@}"
elif [ $COMMAND == "tokens" ]; then
exec $JAVA $OPTS org.apache.pulsar.utils.auth.tokens.TokensCliUtils $@
elif [ $COMMAND == "help" ]; then
elif [ $COMMAND == "help" -o $COMMAND == "--help" -o $COMMAND == "-h" ]; then
pulsar_help;
else
echo ""
Expand Down
13 changes: 10 additions & 3 deletions bin/pulsar-daemon
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ PULSAR_LOG_APPENDER=${PULSAR_LOG_APPENDER:-"RollingFile"}
PULSAR_STOP_TIMEOUT=${PULSAR_STOP_TIMEOUT:-30}
PULSAR_PID_DIR=${PULSAR_PID_DIR:-$PULSAR_HOME/bin}

if [ $# -lt 2 ]
then
echo "Error: no enough arguments provided."
if [ $# = 0 ]; then
usage
exit 1
elif [ $# = 1 ]; then
if [ $1 == "--help" -o $1 == "-h" ]; then
usage
exit 1
else
echo "Error: no enough arguments provided."
usage
exit 1
fi
fi

startStop=$1
Expand Down
6 changes: 3 additions & 3 deletions bin/pulsar-perf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ add_maven_deps_to_classpath() {
}
pulsar_help() {
cat <<EOF
Usage: pulsar <command>
Usage: pulsar-perf <command>
where command is one of:
produce Run a producer
consume Run a consumer
Expand All @@ -87,13 +87,13 @@ where command is one of:
simulation-client Run a simulation server acting as a Pulsar client
simulation-controller Run a simulation controller to give commands to servers
help This help message
help This help message
or command is the full name of a class with a defined main() method.
Environment variables:
PULSAR_LOG_CONF Log4j configuration file (default $DEFAULT_LOG_CONF)
PULSAR_CLIENT_CONF Configuration file for client (default: $DEFAULT_CLIENT_CONF)
PULSAR_CLIENT_CONF Configuration file for client (default: $DEFAULT_CLIENT_CONF)
PULSAR_EXTRA_OPTS Extra options to be passed to the jvm
PULSAR_EXTRA_CLASSPATH Add extra paths to the pulsar classpath
Expand Down

0 comments on commit c0ffa16

Please sign in to comment.