Skip to content

Commit

Permalink
Add option to allow specifying the date format
Browse files Browse the repository at this point in the history
Fixes #43
  • Loading branch information
fixe committed Nov 5, 2014
1 parent 136a68e commit dad94e8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ opts = parser
, help: 'title to appear in the top of the changelog'
, default: 'Change Log'
})
.option('date-format', {
abbr: 'm'
, help: 'date format'
, default: '(YYYY/MM/DD HH:mm Z)'
})
.option('verbose', {
abbr: 'v'
, help: 'output details'
Expand Down Expand Up @@ -286,15 +291,15 @@ var prFormatter = function(data) {
} else if (pr.tag.name != currentTagName) {
currentTagName = pr.tag.name;
output+= "\n### " + pr.tag.name
output+= " (" + pr.tag.date.utc().format("YYYY/MM/DD HH:mm Z") + ")";
output+= " " + pr.tag.date.utc().format(opts['date-format']);
output+= "\n";
}

output += "- [#" + pr.number + "](" + pr.html_url + ") " + pr.title
if (pr.user && pr.user.login) output += " (@" + pr.user.login + ")";
if (opts['issue-body'] && pr.body && pr.body.trim()) output += "\n\n >" + pr.body.trim().replace(/\n/ig, "\n > ") +"\n";

// output += " " + moment(pr.merged_at).utc().format("YYYY/MM/DD HH:mm Z");
// output += " " + moment(pr.merged_at).utc().format(opts['date-format']);
output += "\n";
});
return output.trim();
Expand Down Expand Up @@ -358,7 +363,7 @@ var commitFormatter = function(data) {
} else if (commit.tag.name != currentTagName) {
currentTagName = commit.tag.name;
output+= "\n### " + commit.tag.name
output+= " (" + commit.tag.date.utc().format("YYYY/MM/DD HH:mm Z") + ")";
output+= " " + commit.tag.date.utc().format(opts['date-format']);
output+= "\n";
}

Expand Down Expand Up @@ -402,7 +407,7 @@ var commitFormatter = function(data) {
output += " (@" + commit.author.login + ")";
}

// output += " " + moment(commit.commit.committer.date).utc().format("YYYY/MM/DD HH:mm Z");
// output += " " + moment(commit.commit.committer.date).utc().format(opts['date-format']);
output += "\n";
});
return output.trim();
Expand Down

0 comments on commit dad94e8

Please sign in to comment.