public Integer call()

in src/main/java/org/apache/sling/cli/impl/release/ReleaseJiraVersionCommand.java [72:106]


    public Integer call() {
        try {
            StagingRepository repo = repositoryService.find(repositoryId);
            Set<Release> releases = repositoryService.getReleases(repo);
            ExecutionMode executionMode = reusableCLIOptions.executionMode;
            LOGGER.info("The following Jira versions {} be released:{}", executionMode == ExecutionMode.DRY_RUN ? "would" : "will",
                    System.lineSeparator());
            for (Release release : releases) {
                List<Issue> fixedIssues = versionClient.findFixedIssues(release);
                LOGGER.info("{}:", release.getFullName());
                fixedIssues.forEach(issue -> LOGGER.info("- {} - {}, Status: {}, Resolution: {}", issue.getKey(), issue.getSummary(),
                        issue.getStatus(), issue.getResolution()));
                LOGGER.info("");
                boolean shouldRelease = false;
                if (executionMode == ExecutionMode.INTERACTIVE) {
                    InputOption answer = UserInput.yesNo(String.format("Should version %s be released?", release.getFullName()),
                            InputOption.YES);
                    shouldRelease = (answer == InputOption.YES);
                } else if (executionMode == ExecutionMode.AUTO) {
                    shouldRelease = true;
                }
                if (shouldRelease) {
                    versionClient.release(release);
                    LOGGER.info("{} was released:", release.getFullName());
                    fixedIssues = versionClient.findFixedIssues(release);
                    fixedIssues.forEach(issue -> LOGGER.info("- {} - {}, Status: {}, Resolution: {}", issue.getKey(), issue.getSummary(),
                            issue.getStatus(), issue.getResolution()));
                }
            }
        } catch (Exception e) {
            LOGGER.warn("Failed executing command.", e);
            return CommandLine.ExitCode.SOFTWARE;
        }
        return CommandLine.ExitCode.OK;
    }