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 HDFS-5543. Fix narrow race condition in TestPathBasedCacheRequests
(cmccabe) (cmccabe)
HDFS-5565. CacheAdmin help should match against non-dashed commands
(wang via cmccabe)
Release 2.3.0 - UNRELEASED Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -822,14 +822,15 @@ public class CacheAdmin extends Configured implements Tool {
return 0; return 0;
} }
String commandName = args.get(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) { if (command == null) {
System.err.print("Sorry, I don't know the command '" + System.err.print("Sorry, I don't know the command '" +
commandName + "'.\n"); commandName + "'.\n");
System.err.print("Valid command names are:\n"); System.err.print("Valid help command names are:\n");
String separator = ""; String separator = "";
for (Command c : COMMANDS) { for (Command c : COMMANDS) {
System.err.print(separator + c.getName()); System.err.print(separator + c.getName().substring(1));
separator = ", "; separator = ", ";
} }
System.err.print("\n"); System.err.print("\n");

View File

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