Skip to content

Commit f4391d4

Browse files
authored
fix: make clear where more opts are in help (#1271)
1 parent 1cda8fa commit f4391d4

File tree

5 files changed

+31
-18
lines changed

5 files changed

+31
-18
lines changed

doc/cli/help.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
-V, --verbose ............ show detail on what is causing restarts.
1212
-- <your args> ........... to tell nodemon stop slurping arguments.
1313

14-
More options are available under: nodemon --help options
15-
1614
Note: if the script is omitted, nodemon will try to read "main" from
1715
package.json and without a nodemon.json, nodemon will monitor .js, .mjs, .coffee,
1816
and .litcoffee by default.
@@ -28,4 +26,4 @@
2826
$ nodemon --exec "make build" -e "styl hbs"
2927
$ nodemon app.js -- --config # pass config to app.js
3028

31-
For more details see https://github.com/remy/nodemon/
29+
\x1B[1mAll options are documented under: \x1B[4mnodemon --help options\x1B[0m

lib/help/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
var fs = require('fs');
22
var path = require('path');
3+
const supportsColor = require('supports-color');
34

45
module.exports = help;
56

7+
const highlight = supportsColor.stdout ? '\x1B\[$1m' : '';
8+
69
function help(item) {
710
if (!item) {
811
item = 'help';
@@ -17,8 +20,8 @@ function help(item) {
1720
try {
1821
var dir = path.join(__dirname, '..', '..', 'doc', 'cli', item + '.txt');
1922
var body = fs.readFileSync(dir, 'utf8');
20-
return body;
23+
return body.replace(/\\x1B\[(.)m/g, highlight);
2124
} catch (e) {
2225
return '"' + item + '" help can\'t be found';
2326
}
24-
}
27+
}

lib/utils/colour.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ colour.yellow = '\x1B[33m';
1818
colour.green = '\x1B[32m';
1919
colour.black = '\x1B[39m';
2020

21-
var reStr = Object.keys(colour).map(function (key) {
22-
return colour[key];
23-
}).join('|');
24-
21+
var reStr = Object.keys(colour).map(key => colour[key]).join('|');
2522
var re = new RegExp(('(' + reStr + ')').replace(/\[/g, '\\['), 'g');
2623

2724
colour.strip = strip;
2825

29-
30-
module.exports = colour;
26+
module.exports = colour;

package-lock.json

+22-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"minimatch": "^3.0.4",
6161
"pstree.remy": "^1.1.0",
6262
"semver": "^5.4.1",
63+
"supports-color": "^5.2.0",
6364
"touch": "^3.1.0",
6465
"undefsafe": "^2.0.1",
6566
"update-notifier": "^2.3.0"

0 commit comments

Comments
 (0)