Exemplo n.º 1
0
 @Override
 public void removeCommand(String name) {
   try {
     if (aeshCommandRegistry.getCommand(name, null) != null)
       aeshCommandRegistry.removeCommand(name);
   } catch (CommandNotFoundException e) {
     throw new RuntimeException("Error while removing command: " + e.getMessage(), e);
   }
 }
Exemplo n.º 2
0
  @Override
  public CommandContainer<?> getCommand(String name, String completeLine)
      throws CommandNotFoundException {
    waitUntilStarted();

    ShellContextImpl shellContext = shell.createUIContext();
    try {
      return getForgeCommand(shellContext, name, completeLine);
    } catch (CommandNotFoundException cnfe) {
      // Not a forge command, fallback to aesh command
      CommandContainer<?> nativeCommand = aeshCommandRegistry.getCommand(name, completeLine);
      AeshUICommand aeshCommand = new AeshUICommand(nativeCommand);
      SingleCommandController controller =
          commandControllerFactory.createSingleController(shellContext, shell, aeshCommand);
      try {
        controller.initialize();
      } catch (Exception e) {
        // Do nothing
      }
      ShellSingleCommand cmd = new ShellSingleCommand(controller, shellContext, commandLineUtil);
      CommandAdapter commandAdapter = new CommandAdapter(shell, shellContext, cmd);
      return new ForgeCommandContainer(
          shellContext, aeshCommand.getCommandLineParser(), commandAdapter);
    }
  }
Exemplo n.º 3
0
 @Override
 public Set<String> getAllCommandNames() {
   if (!furnace.getStatus().isStarted()) return Collections.emptySet();
   Set<String> allCommands = new TreeSet<>();
   allCommands.addAll(getForgeCommandNames());
   allCommands.addAll(aeshCommandRegistry.getAllCommandNames());
   return allCommands;
 }