Skip to content

Commit

Permalink
fix: fcli fod issue list: Add --include option to allow for retri…
Browse files Browse the repository at this point in the history
…eving `fixed` and/or `suppressed` issues (fixes #545)
  • Loading branch information
MikeTheSnowman authored May 23, 2024
1 parent 7857239 commit 01c2ac2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.fortify.cli.fod._common.rest.query.FoDFiltersParamGenerator;
import com.fortify.cli.fod._common.rest.query.cli.mixin.FoDFiltersParamMixin;
import com.fortify.cli.fod.issue.cli.mixin.FoDIssueEmbedMixin;
import com.fortify.cli.fod.issue.cli.mixin.FoDIssueIncludeMixin;
import com.fortify.cli.fod.release.cli.mixin.FoDReleaseByQualifiedNameOrIdResolverMixin;

import kong.unirest.HttpRequest;
Expand All @@ -35,6 +36,7 @@ public class FoDIssueListCommand extends AbstractFoDBaseRequestOutputCommand imp
@Mixin private FoDReleaseByQualifiedNameOrIdResolverMixin.RequiredOption releaseResolver;
@Mixin private FoDFiltersParamMixin filterParamMixin;
@Mixin private FoDIssueEmbedMixin embedMixin;
@Mixin private FoDIssueIncludeMixin includeMixin;
@Getter private IServerSideQueryParamValueGenerator serverSideQueryParamGenerator = new FoDFiltersParamGenerator();
// .add("id","applicationId")
// .add("name","applicationName")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.fortify.cli.fod.issue.cli.mixin;

import com.fortify.cli.common.rest.unirest.IHttpRequestUpdater;
import kong.unirest.HttpRequest;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import picocli.CommandLine;
import java.util.List;

public class FoDIssueIncludeMixin implements IHttpRequestUpdater {
@CommandLine.Option(names = {"--include", "-i"}, split = ",", descriptionKey = "fcli.fod.issue.list.includeIssue")
private List<FoDIssueInclude> includes;

public HttpRequest<?> updateRequest(HttpRequest<?> request) {
for ( var include : includes) {
request = request.queryString(include.getRequestParameterName(), "true");
}
return request;
}

@RequiredArgsConstructor
public static enum FoDIssueInclude {
fixed("includeFixed"), suppressed("includeSuppressed");

@Getter
private final String requestParameterName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,9 @@ fcli.fod.issue.embed = Embed extra issue data. Due to FoD rate limits, this may
Using the --output option, this extra data can be included in the output. Using the --query option, \
this extra data can be queried upon. To get an understanding of the structure and contents of the \
embedded data, use the --output json or --output yaml options.
fcli.fod.issue.list.includeIssue = By default, fixed or suppressed issues will not be included. \
This option accepts 'fixed', 'suppressed' or 'fixed,suppressed' to include such issues in the \
output.

# fcli fod report
fcli.fod.report.usage.header = Manage FoD reports.
Expand Down

0 comments on commit 01c2ac2

Please sign in to comment.