Ejemplo n.º 1
0
 /**
  * Return Leading Command String.
  *
  * @param command the node to determine the path to.
  * @return a <code>String</code> of the executable class and command names leading to the given
  *     command. Will never return null.
  */
 public String getLeadingCommandString(CliCommand command) {
   List<String> names = new ArrayList<String>();
   while (command != null) {
     command = command.getParent();
     if (command != null) names.add(command.getCommandName());
   }
   StringBuilder sb = new StringBuilder(cliBase.getExecutableName());
   int size = names.size();
   for (int j = size - 1; j >= 0; j--) sb.append(" " + names.get(j));
   return sb.toString();
 }
Ejemplo n.º 2
0
 /**
  * Add a command child.
  *
  * @param command the child command to add.
  */
 public void addChild(CliCommand command) {
   command.parent = this;
   commands.put(command.getCommandName(), command);
   command.cliSetup();
 }