HDFS-5565. CacheAdmin help should match against non-dashed commands (wang via cmccabe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1545850 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Colin McCabe 2013-11-26 21:38:46 +00:00
parent 740cf232bd
commit 05a9a80bd4
3 changed files with 8 additions and 4 deletions

View File

@ -405,6 +405,9 @@ Trunk (Unreleased)
HDFS-5543. Fix narrow race condition in TestPathBasedCacheRequests
(cmccabe)
HDFS-5565. CacheAdmin help should match against non-dashed commands
(wang via cmccabe)
Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -822,14 +822,15 @@ public class CacheAdmin extends Configured implements Tool {
return 0;
}
String commandName = args.get(0);
Command command = determineCommand(commandName);
// prepend a dash to match against the command names
Command command = determineCommand("-"+commandName);
if (command == null) {
System.err.print("Sorry, I don't know the command '" +
commandName + "'.\n");
System.err.print("Valid command names are:\n");
System.err.print("Valid help command names are:\n");
String separator = "";
for (Command c : COMMANDS) {
System.err.print(separator + c.getName());
System.err.print(separator + c.getName().substring(1));
separator = ", ";
}
System.err.print("\n");

View File

@ -387,7 +387,7 @@
<test>
<description>Testing the help usage</description>
<test-commands>
<cache-admin-command>-help -addPool</cache-admin-command>
<cache-admin-command>-help addPool</cache-admin-command>
</test-commands>
<cleanup-commands>
</cleanup-commands>