Skip to content

Commit 3e8b07d

Browse files
authored
fix(cli-separator): negative value on a long text (#553)
When `text` is longer than 78 characters, `rest` is negative, which raises an error at `repeat`, making some commands unusable.
1 parent f2f77dd commit 3e8b07d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class CLI {
130130
return;
131131
}
132132
const rest = (length - text.length - 2);
133-
const half = sep.repeat(Math.floor(rest / 2));
133+
const half = sep.repeat(Math.abs(Math.floor(rest / 2)));
134134
if (rest % 2 === 0) {
135135
this.log(`${half} ${chalk.bold(text)} ${half}`);
136136
} else {

0 commit comments

Comments
 (0)