-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathutils.js
More file actions
29 lines (25 loc) · 614 Bytes
/
utils.js
File metadata and controls
29 lines (25 loc) · 614 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict'
const chalk = require('chalk')
const CHECK = chalk.green('✔')
const X = chalk.red('✖')
const WARN = chalk.yellow('⚠')
exports.CHECK = CHECK
exports.X = X
exports.WARN = WARN
exports.rightPad = function rightPad(str, max) {
const diff = max - str.length + 1
if (diff > 0) {
return `${str}${' '.repeat(diff)}`
}
return str
}
exports.header = (sha, status) => {
switch (status) {
case 'pass':
return `${CHECK} ${chalk.underline(sha)}`
case 'warn':
return `${WARN} ${chalk.underline(sha)}`
case 'error':
return `${X} ${chalk.underline(sha)}`
}
}