Skip to content

Commit f828405

Browse files
committed
feat(engine): add body character count
1 parent aae2548 commit f828405

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

engine.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,18 @@ module.exports = function(options) {
125125
{
126126
type: 'input',
127127
name: 'body',
128-
message:
129-
'Provide a longer description of the change: (press enter to skip)\n',
130-
default: options.defaultBody
128+
message: function(answers) {
129+
return (
130+
'Provide a longer description of the change (max ' +
131+
options.maxBodyLineWidth +
132+
' chars per line): (press enter to skip)\n'
133+
);
134+
},
135+
default: options.defaultBody,
136+
transformer: function(body) {
137+
var color = chalk.green;
138+
return color('(' + body.length + ') ' + body);
139+
}
131140
},
132141
{
133142
type: 'confirm',

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ var options = {
2323
(process.env.CZ_MAX_LINE_WIDTH &&
2424
parseInt(process.env.CZ_MAX_LINE_WIDTH)) ||
2525
config.maxLineWidth ||
26-
100
26+
100,
27+
maxBodyLineWidth: config.maxBodyLineWidth || 80
2728
};
2829

2930
(function(options) {

0 commit comments

Comments
 (0)