simplied the valid option check to pure regex

This commit is contained in:
emizzle 2018-09-15 11:38:48 +10:00
parent 269d544ab3
commit 6e444aaf65
1 changed files with 1 additions and 1 deletions

View File

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