diff --git a/doc/cli/help.txt b/doc/cli/help.txt index c39784b3..11b749ff 100644 --- a/doc/cli/help.txt +++ b/doc/cli/help.txt @@ -11,8 +11,6 @@ -V, --verbose ............ show detail on what is causing restarts. -- ........... to tell nodemon stop slurping arguments. - More options are available under: nodemon --help options - Note: if the script is omitted, nodemon will try to read "main" from package.json and without a nodemon.json, nodemon will monitor .js, .mjs, .coffee, and .litcoffee by default. @@ -28,4 +26,4 @@ $ nodemon --exec "make build" -e "styl hbs" $ nodemon app.js -- --config # pass config to app.js - For more details see https://github.com/remy/nodemon/ + \x1B[1mAll options are documented under: \x1B[4mnodemon --help options\x1B[0m diff --git a/lib/help/index.js b/lib/help/index.js index af1a1e11..1054b602 100644 --- a/lib/help/index.js +++ b/lib/help/index.js @@ -1,8 +1,11 @@ var fs = require('fs'); var path = require('path'); +const supportsColor = require('supports-color'); module.exports = help; +const highlight = supportsColor.stdout ? '\x1B\[$1m' : ''; + function help(item) { if (!item) { item = 'help'; @@ -17,8 +20,8 @@ function help(item) { try { var dir = path.join(__dirname, '..', '..', 'doc', 'cli', item + '.txt'); var body = fs.readFileSync(dir, 'utf8'); - return body; + return body.replace(/\\x1B\[(.)m/g, highlight); } catch (e) { return '"' + item + '" help can\'t be found'; } -} \ No newline at end of file +} diff --git a/lib/utils/colour.js b/lib/utils/colour.js index a4cb6f45..8c1b5905 100644 --- a/lib/utils/colour.js +++ b/lib/utils/colour.js @@ -18,13 +18,9 @@ colour.yellow = '\x1B[33m'; colour.green = '\x1B[32m'; colour.black = '\x1B[39m'; -var reStr = Object.keys(colour).map(function (key) { - return colour[key]; -}).join('|'); - +var reStr = Object.keys(colour).map(key => colour[key]).join('|'); var re = new RegExp(('(' + reStr + ')').replace(/\[/g, '\\['), 'g'); colour.strip = strip; - -module.exports = colour; \ No newline at end of file +module.exports = colour; diff --git a/package-lock.json b/package-lock.json index fba233a4..f7a0961f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -549,6 +549,21 @@ "ansi-styles": "3.2.0", "escape-string-regexp": "1.0.5", "supports-color": "4.5.0" + }, + "dependencies": { + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "requires": { + "has-flag": "2.0.0" + } + } } }, "chokidar": { @@ -2767,9 +2782,9 @@ "dev": true }, "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "has-unicode": { "version": "2.0.1", @@ -5541,11 +5556,11 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.2.0.tgz", + "integrity": "sha512-F39vS48la4YvTZUPVeTqsjsFNrvcMwrV3RLZINsmHo+7djCvuUzSIeXOnZ5hmjef4bajL1dNccN+tg5XAliO5Q==", "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } }, "term-size": { diff --git a/package.json b/package.json index 9e8f9b0b..0cd5a0f7 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "minimatch": "^3.0.4", "pstree.remy": "^1.1.0", "semver": "^5.4.1", + "supports-color": "^5.2.0", "touch": "^3.1.0", "undefsafe": "^2.0.1", "update-notifier": "^2.3.0"