hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daryn Sharp (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8074) Small bug in hadoop error message for unknown commands
Date Wed, 15 Feb 2012 23:00:00 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-8074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13208924#comment-13208924
] 

Daryn Sharp commented on HADOOP-8074:
-------------------------------------

Or for user-friendliness, something like this.  I was hoping someday to make the leading dash
optional if I got around to adding interactive readline support.

{code}
--- hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java	(revision
1242960)
+++ hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java	(working
copy)
@@ -23,6 +23,7 @@
 import java.util.Arrays;
 import java.util.LinkedList;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
@@ -251,11 +252,15 @@
         if (instance == null) {
           throw new UnknownCommandException();
         }
+        cmd = instance.getName();
         exitCode = instance.run(Arrays.copyOfRange(argv, 1, argv.length));
       } catch (IllegalArgumentException e) {
         displayError(cmd, e.getLocalizedMessage());
         if (instance != null) {
           printInstanceUsage(System.err, instance);
+        } else {
+          System.err.println("Available commands: " +
+              StringUtils.join(commandFactory.getNames(), " "));
         }
       } catch (Exception e) {
         // instance.run catches IOE, so something is REALLY wrong if here
@@ -269,7 +274,7 @@
   
   private void displayError(String cmd, String message) {
     for (String line : message.split("\n")) {
-      System.err.println(cmd.substring(1) + ": " + line);
+      System.err.println(cmd + ": " + line);
     }
   }
{code}
                
> Small bug in hadoop error message for unknown commands
> ------------------------------------------------------
>
>                 Key: HADOOP-8074
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8074
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: scripts
>    Affects Versions: 0.24.0
>            Reporter: Eli Collins
>            Assignee: Colin Patrick McCabe
>            Priority: Trivial
>             Fix For: 0.23.2
>
>         Attachments: HADOOP-8074.txt
>
>
> The hadoop fs command should be more user friendly if the user forgets the dash before
the command. Also, this should say "cat" rather than "at".
> {noformat}
> hadoop-0.24.0-SNAPSHOT $ ./bin/hadoop fs cat
> at: Unknown command
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message