Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
changelog: add body option to print full commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
skenqbx committed Nov 25, 2015
1 parent a0f631d commit cad29c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Usage: changelog42 [--since={tag}] [--commit-url={url}] [options]
--no-group do not group commits by scope
--no-author do not print author name
--no-link do not link commit hashes
--body print full commit message
--merge print merge commits
--json output JSON
--commit-url commit base url
Expand Down
5 changes: 5 additions & 0 deletions bin/changelog42.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var options = {
since: '--tags',
group: true,
author: true,
body: false,
link: true,
merge: false,
commitURL: '<commit-url>'
Expand All @@ -37,6 +38,7 @@ for (i = 2; i < process.argv.length; ++i) {
console.log(' --no-group do not group commits by scope');
console.log(' --no-author do not print author name');
console.log(' --no-link do not link commit hashes');
console.log(' --body print full commit message');
console.log(' --merge print merge commits');
console.log(' --json output JSON');
console.log(' --commit-url commit base url');
Expand All @@ -58,6 +60,9 @@ for (i = 2; i < process.argv.length; ++i) {
case '--merge':
options.merge = true;
break;
case '--body':
options.body = true;
break;
case '--json':
options.json = true;
break;
Expand Down
7 changes: 7 additions & 0 deletions lib/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function ChangeLog(opt_options) {
this.pullRequestURL = opt_options.pullRequestURL || '<pr-url>';

this.group = opt_options.group || false;
this.body = opt_options.body || false;
this.author = opt_options.author || false;
this.link = opt_options.link || false;
this.merge = opt_options.merge || false;
Expand Down Expand Up @@ -204,6 +205,12 @@ ChangeLog.prototype.toMarkdown = function(commits) {
md += ' (' + commit.author.name + ')';
}

if (this.body && commit.body) {
md += '\n\n ';
md += commit.body.replace(/\n/g, ' ').replace(/ /g, ' ').trim();
md += '\n';
}

markdown.push(md);
}

Expand Down

0 comments on commit cad29c9

Please sign in to comment.