Logo Search packages:      
Sourcecode: henplus version File versions  Download package

String henplus::commands::AliasCommand::getLongDescription ( String  cmd  )  [inline]

returns a longer string describing this action. This should return a String describing details of the given command. This String should start with a TAB-character in each new line (the first line is a new line). The last line should not end with newline.

Parameters:
cmd The command the long description is asked for. This is one of the possible commands returned by getCommandList().

Reimplemented from henplus::AbstractCommand.

Definition at line 321 of file AliasCommand.java.

References _currentExecutedAliases, henplus::CommandDispatcher::getCommandFrom(), and henplus::Command::getLongDescription().

                                                 {
      String dsc = null;
        if ("list-aliases".equals(cmd)) {
            dsc= "\tList all aliases, that have been stored with the\n"
                +"\t'alias' command";
        }
        else if ("alias".equals(cmd)) {
            dsc= "\tAdd an alias for a command. This means, that you can\n"
                +"\tgive a short name for a command you often use.  This\n"
                +"\tmight be as simple as\n"
                +"\t   alias ls tables\n"
                +"\tto execute the tables command with a short 'ls'.\n"
                +"\n\tFor longer commands it is even more helpful:\n"
                +"\t   alias size select count(*) from\n"
                +"\tThis command  needs a table  name as a  parameter to\n"
                +"\texpand  to  a  complete command.  So 'size students'\n"
                +"\texpands to 'select count(*) from students' and yields\n"
                +"\tthe expected result.\n"
                +"\n\tTo make life easier, HenPlus tries to determine the\n"
                +"\tcommand  to be executed so that the  tab-completion\n"
                +"\tworks even here; in this latter case it  would help\n"
                +"\tcomplete table names.";
        }
        else if ("unalias".equals(cmd)) {
            dsc= "\tremove an alias name";
        }
        else {
          // not session-proof:
          if (_currentExecutedAliases.contains(cmd)) {
            dsc = "\t[ this command cyclicly references itself ]";
          }
            else {
                _currentExecutedAliases.add(cmd);
                dsc= "\tThis is an alias for the command\n"
                    +"\t   " + _aliases.get(cmd);

                String actualCmdStr = (String) _aliases.get(cmd);
                if (actualCmdStr != null) {
                    StringTokenizer st = new StringTokenizer(actualCmdStr);
                    actualCmdStr = st.nextToken();
                    Command c = _dispatcher.getCommandFrom(actualCmdStr);
                    String longDesc = null;
                    if (c != null 
                        && (longDesc=c.getLongDescription(actualCmdStr)) != null) {
                        dsc+="\n\n\t..the following description could be determined for this";
                        dsc+="\n\t------- [" + actualCmdStr + "] ---\n";
                        dsc+=longDesc;
                    }
                    _currentExecutedAliases.clear();
                }
            }
        }
        return dsc;
    }


Generated by  Doxygen 1.6.0   Back to index