From 0a962e1eae76599ca7dff8faedf9b4fb322eb724 Mon Sep 17 00:00:00 2001 From: Teal Hobson-Lowther Date: Thu, 13 Sep 2018 15:04:05 -0700 Subject: [PATCH] add issue severity to console output of cli --- cli.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cli.js b/cli.js index 63f05a938..bbc862ef9 100644 --- a/cli.js +++ b/cli.js @@ -20,13 +20,13 @@ module.exports = function(dir, options) { if (issues.errors.length === 1 && issues.errors[0].code === '61') { console.log( colors.red( - 'The directory ' + + '[ERR] The directory ' + dir + ' failed an initial Quick Test. This means the basic names and structure of the files and directories do not comply with BIDS specification. For more info go to http://bids.neuroimaging.io/', ), ) } else if (issues.config && issues.config.length >= 1) { - console.log(colors.red('Invalid Config File')) + console.log(colors.red('[ERR] Invalid Config File')) for (var i = 0; i < issues.config.length; i++) { var issue = issues.config[i] issue.file.file = { relativePath: issue.file.path } @@ -58,14 +58,16 @@ module.exports = function(dir, options) { } function logIssues(issues, color, options) { + const severity = color == 'red' ? 'ERR' : 'WARN' for (var i = 0; i < issues.length; i++) { - var issue = issues[i] + const issue = issues[i] + const issueNumber = i + 1 console.log( '\t' + colors[color]( - i + - 1 + + issueNumber + ': ' + + `[${severity}] ` + issue.reason + ' (code: ' + issue.code +