You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ey...@apache.org on 2011/10/22 00:31:14 UTC
svn commit: r1187580 - in /incubator/ambari/trunk: CHANGES.txt
client/src/main/java/org/apache/ambari/client/AmbariClient.java
Author: eyang
Date: Fri Oct 21 22:31:13 2011
New Revision: 1187580
URL: http://svn.apache.org/viewvc?rev=1187580&view=rev
Log:
AMBARI-96. Updated ambar client to show usage screen. (Eric Yang)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/AmbariClient.java
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1187580&r1=1187579&r2=1187580&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Oct 21 22:31:13 2011
@@ -2,6 +2,8 @@ Ambari Change log
Release 0.1.0 - unreleased
+ AMBARI-96. Updated ambar client to show usage screen. (Eric Yang)
+
AMBARI-93. Update -revision parameter to make it optional. (Eric Yang)
AMBARI-92. Added logic to retry heartbeat sending. (Eric Yang)
Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/AmbariClient.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/AmbariClient.java?rev=1187580&r1=1187579&r2=1187580&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/AmbariClient.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/AmbariClient.java Fri Oct 21 22:31:13 2011
@@ -58,6 +58,14 @@ public class AmbariClient {
}
+ public static void usage(HashMap<String, HashMap<String, String>> commands) {
+ System.out.println("Usage: AmbariClient <CommandCateogry> <CommandName> <CommandOptions>\n");
+ System.out.println("To get the help on each command use -help e.g. \"AmbariClient cluster list -help\"\n");
+ for (String category : commands.keySet()) {
+ System.out.println("CommandCategory : ["+ category+"] : Commands "+commands.get(category).keySet());
+ }
+ }
+
/**
* @param args
*/
@@ -74,11 +82,7 @@ public class AmbariClient {
*/
if (args.length < 2) {
if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
- System.out.println("Usage: AmbariClient <CommandCateogry> <CommandName> <CommandOptions>\n");
- System.out.println("To get the help on each command use -help e.g. \"AmbariClient cluster list -help\"\n");
- for (String category : c.commands.keySet()) {
- System.out.println("CommandCategory : ["+ category+"] : Commands "+c.commands.get(category).keySet());
- }
+ usage(c.commands);
System.exit(0);
}
if (args[0].equalsIgnoreCase("version")) {
@@ -95,6 +99,11 @@ public class AmbariClient {
System.exit(-1);
}
+ if(args.length<2) {
+ usage(c.commands);
+ System.exit(-1);
+ }
+
if (!c.commands.get(args[0]).containsKey(args[1])){
System.out.println("Invalid command ["+args[1]+"] for category ["+args[0]+"]");
System.exit(-1);