Fix CLI option parsing (#2684)

Fixes #2683
This commit is contained in:
Simon Lydell authored and GitHub committed 2017-08-29 08:16:04 +02:00
1 parent a44ef1fe8b
commit 7c9e589323
4 files changed
+87 -10

No files matched your search

+4 -10
View File
@@ -49,7 +49,7 @@ const argv = minimist(args, {
"debug-print-doc",
"debug-check",
"with-node-modules"
],
].concat(booleanOptionNames),
string: [
"cursor-offset",
"range-start",
@@ -58,7 +58,7 @@ const argv = minimist(args, {
"config",
"find-config-path",
"ignore-path"
],
].concat(stringOptionNames),
default: {
color: true,
"ignore-path": ".prettierignore"
@@ -70,14 +70,8 @@ const argv = minimist(args, {
},
unknown: param => {
if (param.startsWith("-")) {
const paramName = param.replace(/--(no-)?/, "");
if (
booleanOptionNames.indexOf(paramName) === -1 &&
stringOptionNames.indexOf(paramName) === -1
) {
console.warn("Ignored unknown option: " + param + "\n");
return false;
}
console.warn("Ignored unknown option: " + param + "\n");
return false;
}
}
});