Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adds additonal fields flag #13

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ package.json
package-lock.json
node_modules
docker/git-changelog-command-line.jar
.vscode
.sdkmanrc
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ Or from command line:
include actual releases.
<string>: any string
Default: null
-jaf, --jira-additional-field <string> Adds an additional field for Jira.
When configured, we will return
from Jira the result of this
field, if it exists. [Supports Multiple occurrences]
<string>: any string
Default: Empty list
-jba, --jira-basic-auth <string> Optional token to authenticate
with Jira.
<string>: any string
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply from: project.buildscript.classLoader.getResource('main.gradle').toURI()


dependencies {
implementation 'se.bjurr.gitchangelog:git-changelog-lib:1.169.0'
implementation 'se.bjurr.gitchangelog:git-changelog-lib:1.170.0'
implementation 'se.softhouse:jargo:0.4.14'
implementation 'org.slf4j:slf4j-simple:2.0.6'
implementation 'com.google.code.gson:gson:2.10.1'
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/se/bjurr/gitchangelog/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class Main {
public static final String PARAM_JIRA_PASSWORD = "-jpw";
public static final String PARAM_JIRA_BASIC_AUTH = "-jba";
public static final String PARAM_JIRA_BEARER = "-jbt";
public static final String PARAM_JIRA_ADDITIONAL_FIELD = "-jaf";
public static final String PARAM_REDMINE_SERVER = "-rms";
public static final String PARAM_REDMINE_ISSUE_PATTERN = "-rmp";
public static final String PARAM_REDMINE_USERNAME = "-rmu";
Expand Down Expand Up @@ -205,6 +206,12 @@ public static void main(final String args[]) throws Exception {
.description("Optional token to authenticate with Jira.") //
.defaultValue(defaultSettings.getJiraIssuePattern()) //
.build();
final Argument<List<String>> jiraAdditionalFieldArgument =
stringArgument(PARAM_JIRA_ADDITIONAL_FIELD, "--jira-additional-field") //
.repeated()
.description(
"Adds an additional field for Jira. When configured, we will return from Jira the result of this field, if it exists.") //
.build();

final Argument<String> redmineServerArgument =
stringArgument(PARAM_REDMINE_SERVER, "--redmine-server") //
Expand Down Expand Up @@ -467,6 +474,7 @@ public static void main(final String args[]) throws Exception {
jiraPasswordPatternArgument,
jiraBasicAuthStringPatternArgument,
jiraBearerArgument,
jiraAdditionalFieldArgument,
redmineUsernameArgument,
redminePasswordArgument,
redmineTokenArgument,
Expand Down Expand Up @@ -603,6 +611,9 @@ public static void main(final String args[]) throws Exception {
if (arg.wasGiven(jiraBearerArgument)) {
changelogApiBuilder.withJiraBearer(arg.get(jiraBearerArgument));
}
if (arg.wasGiven(jiraAdditionalFieldArgument)) {
arg.get(jiraAdditionalFieldArgument).forEach(changelogApiBuilder::withJiraIssueAdditionalField);
}
if (arg.wasGiven(redmineIssuePatternArgument)) {
changelogApiBuilder.withRedmineIssuePattern(arg.get(redmineIssuePatternArgument));
}
Expand Down