ticlawk 0.1.16-dev.10 → 0.1.16-dev.11
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/package.json +1 -1
- package/src/core/argv.mjs +11 -1
package/package.json
CHANGED
package/src/core/argv.mjs
CHANGED
|
@@ -29,7 +29,17 @@ export function parseOptionArgs(argv = []) {
|
|
|
29
29
|
const value = inlineValue !== undefined
|
|
30
30
|
? inlineValue
|
|
31
31
|
: argv[i + 1] && !argv[i + 1].startsWith('-') ? argv[++i] : true;
|
|
32
|
-
|
|
32
|
+
// Repeated flags collect into an array so `--attach a --attach b`
|
|
33
|
+
// surfaces as ['a','b'] to callers that expect repeatable input
|
|
34
|
+
// (--attach on message send, --member on group create, etc).
|
|
35
|
+
// First occurrence stays scalar so single-value callers don't
|
|
36
|
+
// have to learn array-or-string.
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(args, rawKey)) {
|
|
38
|
+
const existing = args[rawKey];
|
|
39
|
+
args[rawKey] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
40
|
+
} else {
|
|
41
|
+
args[rawKey] = value;
|
|
42
|
+
}
|
|
33
43
|
continue;
|
|
34
44
|
}
|
|
35
45
|
args._.push(arg);
|