Skip to content

Commit

Permalink
fix: make clear where more opts are in help (#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
remy authored Feb 27, 2018
1 parent 1cda8fa commit f4391d4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
4 changes: 1 addition & 3 deletions doc/cli/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
-V, --verbose ............ show detail on what is causing restarts.
-- <your args> ........... 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.
Expand All @@ -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
7 changes: 5 additions & 2 deletions lib/help/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
}
}
}
8 changes: 2 additions & 6 deletions lib/utils/colour.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
module.exports = colour;
29 changes: 22 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f4391d4

Please sign in to comment.