Skip to content

Commit

Permalink
Prepare release 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephenodrom committed Apr 26, 2024
1 parent 1f42652 commit eee4c54
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.6.0

- Fix REPLACE value for addIssueLink parameter
- Add new value REPLACE_ALL for addIssueLink parameter

## 1.5.0

- Add new parameter "--filterDuplicates" (#1)
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Git Log Markdown Formater is a command line tool to convert a git log one line o
- [How to use it](#how-to-use-it)
- [Example](#example)
- [Parameters](#parameters)
- [Additional Description](#additional-description)
- [The template](#the-template)
- [Pipeline example](#pipeline-example)
- [.gitlab-ci.yml](#gitlab-ciyml)
Expand Down Expand Up @@ -34,14 +35,26 @@ Git Log Markdown Formater is a command line tool to convert a git log one line o
| --issueType | The issue management software you use. | JIRA (default), GITHUB, GITLAB | |
| --iBaseUrl | The base url to display the issue. | | Required if addIssueLink != NONE |
| --cBaseUrl | The base url to display the commit. | | Required if addCommitLink != NONE |
| --addIssueLink | Whether to add a issue link within the subject (%s) if one is found. | NONE, REPLACE (default), PREPEND, APPEND | |
| --addIssueLink | Whether to add a issue link within the subject (%s) if one is found. | NONE, REPLACE (default), REPLACE_ALL, PREPEND, APPEND | |
| --addCommitLink | Whether to add a commit link to the hash (%H) or replace it. | NONE, REPLACE (default), PREPEND, APPEND | |
| --header | String to append at the beginning of the markdown. | | |
| --footer| String to append at the end of the markdown. | | |
| --excludeAuthor| The author to exclude. You can use * to perform a 'like' search. | | |
| --noMerges| Ignore merge requests | true, false (default) | |
| --filterDuplicates| Filter entries with already existing commit messages | true, false (default) | |

#### Additional Description

**addIssueLink**:

Assuming you have the following commit message as the subject "JIRA-1234 - Fixing some stuff" and the following template "- %s".

- NONE "- JIRA-1234 - Fixing some stuff"
- REPLACE (default): "- [JIRA-1234](https://link.to.my.jira/JIRA-1234) - Fixing some stuff"
- REPLACE_ALL: "- [JIRA-1234](https://link.to.my.jira/JIRA-1234)"
- PREPEND: "- [JIRA-1234](https://link.to.my.jira/JIRA-1234) JIRA-1234 - Fixing some stuff"
- APPEND: "- JIRA-1234 - Fixing some stuff [JIRA-1234](https://link.to.my.jira/JIRA-1234)"

### The template

You can define a custom template to order the values in a certain order or to create a readable markdown. The default template is set to **"- %s %H by %an"** and with all other default settings, this will result in something similar to this:
Expand Down
7 changes: 6 additions & 1 deletion bin/src/format_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class FormatCommand extends Command {
"REPLACE",
"PREPEND",
"APPEND",
"REPLACE_ALL",
],
help: "To add a issue link at the end of the subject (%s).",
);
Expand Down Expand Up @@ -355,17 +356,21 @@ class FormatCommand extends Command {
String processModoluS(String? m, String formattedLine, String line) {
var issue = getIssue(line);
var link = "";
m ??= "NULL";
if (issue != null && issue.length > 1) {
link = issueType == "JIRA" ? issue : issue.substring(1);
}
if (issue != null && addIssueLink == "REPLACE") {
var tmp = m.replaceAll(issue, "[$issue]($ibu$link)");
formattedLine = formattedLine.replaceAll("%s", tmp);
} else if (issue != null && addIssueLink == "REPLACE_ALL") {
formattedLine = formattedLine.replaceAll("%s", "[$issue]($ibu$link)");
} else if (issue != null && addIssueLink == "PREPEND") {
formattedLine = formattedLine.replaceAll("%s", " [$issue]($ibu$link) $m");
} else if (issue != null && addIssueLink == "APPEND") {
formattedLine = formattedLine.replaceAll("%s", "$m [$issue]($ibu$link)");
} else {
formattedLine = formattedLine.replaceAll("%s", m ?? "NULL");
formattedLine = formattedLine.replaceAll("%s", m);
}
return formattedLine;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: git_log_markdown_formatter
description: A sample command-line application with basic argument parsing.
version: 1.5.0
version: 1.6.0

environment:
sdk: ^3.2.2
Expand Down
17 changes: 17 additions & 0 deletions test/format_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,21 @@ s=JIRA-1234: Fix Typo;H=f2d9429a6bd955d12c2d82d481a46547cca51ccf;an=romgrm
var markdown = cmd.formatLines(log8.split("\n"));
expect(markdown, expected8);
});

test('test processModuluS', () async {
var cmd = FormatCommand();
cmd.cbu = "https://github.com/Ephenodrom/Dart-Basic-Utils/commit/";
cmd.ibu = "https://github.com/Ephenodrom/Dart-Basic-Utils/issues/";
cmd.issueType = "JIRA";
cmd.template = "- %s";
cmd.addIssueLink = "REPLACE";
var line =
"s=JIRA-1234 - Fixing some stuff;H=e03ba499fd3238879ca3f2f2badf7457d61b0e7f;an=Ephenodrom";
var template = "- %s";
var m = "JIRA-1234 - Fixing some stuff";

var result = cmd.processModoluS(m, template, line);
expect(result,
"- [JIRA-1234](https://github.com/Ephenodrom/Dart-Basic-Utils/issues/JIRA-1234) - Fixing some stuff");
});
}

0 comments on commit eee4c54

Please sign in to comment.