hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1461356 - in /hadoop/common/branches/branch-1: CHANGES.txt bin/hadoop
Date Tue, 26 Mar 2013 22:38:57 GMT
Author: llu
Date: Tue Mar 26 22:38:57 2013
New Revision: 1461356

URL: http://svn.apache.org/r1461356
Log:
HADOOP-9434. Backport HADOOP-9267: hadoop -h|-{0,2}help should print usage. (Yu Li via llu)

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/bin/hadoop

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1461356&r1=1461355&r2=1461356&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Tue Mar 26 22:38:57 2013
@@ -93,6 +93,9 @@ Release 1.2.0 - unreleased
 
   IMPROVEMENTS
 
+    HADOOP-9434. Backport HADOOP-9267: hadoop -h|-{0,2}help should print usage.
+    (Yu Li via llu)
+
     HDFS-3515. Port HDFS-1457 to branch-1. (eli)
 
     HDFS-3479. Port HDFS-3335 to branch-1. (Colin Patrick McCabe via eli)

Modified: hadoop/common/branches/branch-1/bin/hadoop
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/bin/hadoop?rev=1461356&r1=1461355&r2=1461356&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/bin/hadoop (original)
+++ hadoop/common/branches/branch-1/bin/hadoop Tue Mar 26 22:38:57 2013
@@ -68,8 +68,8 @@ case "`uname`" in
 CYGWIN*) cygwin=true;;
 esac
 
-# if no args specified, show usage
-if [ $# = 0 ]; then
+print_usage()
+{
   echo "Usage: hadoop [--config confdir] COMMAND"
   echo "where COMMAND is one of:"
   echo "  namenode -format     format the DFS filesystem"
@@ -98,6 +98,11 @@ if [ $# = 0 ]; then
   echo " or"
   echo "  CLASSNAME            run the class named CLASSNAME"
   echo "Most commands print help when invoked w/o parameters."
+}
+
+# if no args specified, show usage
+if [ $# = 0 ]; then
+  print_usage
   exit 1
 fi
 
@@ -105,6 +110,15 @@ fi
 COMMAND=$1
 shift
 
+# support help commands
+case $COMMAND in
+  # usage flags
+  --help|-help|-h|help)
+    print_usage
+    exit 0
+    ;;
+esac
+
 # Determine if we're starting a secure datanode, and if so, redefine appropriate variables
 if [ "$COMMAND" == "datanode" ] && [ "$EUID" -eq 0 ] && [ -n "$HADOOP_SECURE_DN_USER"
]; then
   HADOOP_PID_DIR=$HADOOP_SECURE_DN_PID_DIR



Mime
View raw message