node-confmanager 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/main.js +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/main.js
CHANGED
|
@@ -60,19 +60,27 @@ module.exports = class ConfManager extends Container {
|
|
|
60
60
|
if (arg.startsWith("-")) {
|
|
61
61
|
|
|
62
62
|
const isShortcut = !arg.startsWith("--");
|
|
63
|
-
|
|
64
63
|
const argument = arg.slice(isShortcut ? 1 : 2, arg.length);
|
|
65
64
|
|
|
66
|
-
if (!isShortcut || this.shortcuts[argument]) {
|
|
65
|
+
if (argument && (!isShortcut || this.shortcuts[argument])) {
|
|
67
66
|
|
|
68
67
|
const key = isShortcut ? this.shortcuts[argument] : argument;
|
|
69
68
|
|
|
70
|
-
if (
|
|
71
|
-
this.set(key, args[i + 1]);
|
|
72
|
-
}
|
|
73
|
-
else if (this.skeletons[key] && "boolean" === this.skeletons[key]) {
|
|
69
|
+
if (this.skeletons[key] && "boolean" === this.skeletons[key]) {
|
|
74
70
|
this.set(key, true);
|
|
75
71
|
}
|
|
72
|
+
else if (i + 1 >= args.length) {
|
|
73
|
+
throw new ReferenceError("Missing value for \"" + argument + "\" key (no more arguments)");
|
|
74
|
+
}
|
|
75
|
+
else if (args[i + 1].startsWith("--")) {
|
|
76
|
+
throw new ReferenceError("Missing value for \"" + argument + "\" key (next argument is a valid key)");
|
|
77
|
+
}
|
|
78
|
+
else if (args[i + 1].startsWith("-") && this.shortcuts[args[i + 1].slice(1)]) {
|
|
79
|
+
throw new ReferenceError("Missing value for \"" + argument + "\" key (next argument is a valid shortcut)");
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.set(key, args[i + 1]);
|
|
83
|
+
}
|
|
76
84
|
|
|
77
85
|
}
|
|
78
86
|
|