@Override
  protected CommandResult doExecute(CommandInvocation commandInvocation) throws Exception {
    ArtificerAtomApiClient client = client(commandInvocation);
    BaseArtifactType artifact = currentArtifact(commandInvocation);

    try {
      client.updateArtifactMetaData(artifact);
      commandInvocation
          .getShell()
          .out()
          .println(Messages.i18n.format("UpdateMetaData.Success", artifact.getName()));
    } catch (Exception e) {
      commandInvocation.getShell().out().println(Messages.i18n.format("UpdateMetaData.Failure"));
      commandInvocation.getShell().out().println("\t" + e.getMessage());
      return CommandResult.FAILURE;
    }
    return CommandResult.SUCCESS;
  }
  @Override
  public CommandResult execute(CommandInvocation commandInvocation)
      throws IOException, InterruptedException {

    if (help) {
      commandInvocation.getShell().out().println(commandInvocation.getHelpInfo("find"));
      return CommandResult.SUCCESS;
    }

    Searcher entity = new Searcher();
    entity.setFileName(fileName);
    entity.setFolderPath(folderPath);

    searcher.setEntity(entity);

    searcher.execute();

    return CommandResult.SUCCESS;
  }
Пример #3
0
  @Override
  public CommandResult execute(CommandInvocation commandInvocation) throws IOException {
    if (help) {
      commandInvocation.getShell().out().print(commandInvocation.getHelpInfo("cd"));
      return CommandResult.SUCCESS;
    }

    if (arguments == null) {
      updatePrompt(
          commandInvocation,
          commandInvocation
              .getAeshContext()
              .getCurrentWorkingDirectory()
              .newInstance(Config.getHomeDir()));
    } else {
      List<Resource> files =
          arguments.get(0).resolve(commandInvocation.getAeshContext().getCurrentWorkingDirectory());

      if (files.get(0).isDirectory()) updatePrompt(commandInvocation, files.get(0));
    }
    return CommandResult.SUCCESS;
  }
Пример #4
0
 private void updatePrompt(CommandInvocation commandInvocation, Resource file) {
   commandInvocation.getAeshContext().setCurrentWorkingDirectory(file);
   commandInvocation.setPrompt(new Prompt("[aesh@extensions:" + file.toString() + "]$ "));
 }