show option usage help with invalid `—node` option and simplied the valid option check to pure regex

This commit is contained in:
emizzle 2018-09-15 11:32:16 +10:00
parent 203039763d
commit 269d544ab3
1 changed files with 1 additions and 0 deletions

View File

@ -278,6 +278,7 @@ class Cmd {
const urlRegexExp = /^(vm|embark|((ws|https?):\/\/([a-zA-Z0-9_.-]*):?([0-9]*)?))$/i;
if (!(node === 'embark' || node === 'vm' || node.match(urlRegexExp))) {
console.error(`invalid --node option: must be 'vm', 'embark' or a valid URL`.red);
options.outputHelp();
process.exit(1);
}
options.node = node;