From 56c621c68f5b50474a69e3bd6284d06aeb192517 Mon Sep 17 00:00:00 2001 From: Adam Antal Date: Mon, 17 Jun 2019 22:55:06 -0700 Subject: [PATCH] HADOOP-15914. hadoop jar command has no help argument. Contributed by Adam Antal. Signed-off-by: Wei-Chiu Chuang --- hadoop-common-project/hadoop-common/src/main/bin/hadoop | 4 ++++ hadoop-common-project/hadoop-common/src/main/bin/hadoop.cmd | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop b/hadoop-common-project/hadoop-common/src/main/bin/hadoop index 750dca3145..7d9ffc69bc 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop @@ -140,6 +140,10 @@ function hadoopcmd_case if [[ -n "${YARN_OPTS}" ]] || [[ -n "${YARN_CLIENT_OPTS}" ]]; then hadoop_error "WARNING: Use \"yarn jar\" to launch YARN applications." fi + if [[ -z $1 || $1 = "--help" ]]; then + echo "Usage: hadoop jar [mainClass] args..." + exit 0 + fi HADOOP_CLASSNAME=org.apache.hadoop.util.RunJar ;; jnipath) diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop.cmd b/hadoop-common-project/hadoop-common/src/main/bin/hadoop.cmd index 91c65d1f2d..04e5039d19 100644 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop.cmd +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop.cmd @@ -189,6 +189,11 @@ call :updatepath %HADOOP_BIN_PATH% ) else if defined YARN_CLIENT_OPTS ( @echo WARNING: Use "yarn jar" to launch YARN applications. ) + @rem if --help option is used, no need to call command + if [!hadoop-command-arguments[%1%]!]==["--help"] ( + @echo Usage: hadoop jar [mainClass] args... + goto :eof + ) set CLASS=org.apache.hadoop.util.RunJar goto :eof