summaryrefslogtreecommitdiff
path: root/scripts/nitpick/index.js
blob: 31316e7521156d9b9b48afd3f32f6895fb269de4 (plain)
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
var failed = false;

process.on('exit', function() {
    if (failed) {
        process.exitCode = 1;
    }
});

module.exports = function(status, str, desc) {
    if (status) {
        console.warn(`\x1b[1m\x1b[32m✔︎ ${str}\x1b[0m`);
    } else {
        console.warn(`\x1b[1m\x1b[31m✘ ${str}\x1b[0m`);
        failed = true;
    }

    if (desc) {
        console.warn(`${desc.split('\n').map((line) => '|   ' + line).join('\n')}\n`);
    }
};

module.exports.ok = function(str, desc) {
    module.exports(true, str, desc);
};

module.exports.fail = function(str, desc) {
    module.exports(false, str, desc);
};