@alcyone-labs/arg-parser 2.8.0 → 2.8.2
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 +159 -73
- package/dist/core/ArgParserBase.d.ts.map +1 -1
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.cjs +30 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.mjs +382 -359
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +30 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1073,6 +1073,7 @@ const zodFlagSchema = z.object({
|
|
|
1073
1073
|
"Allow passing the same flag multiple times, e.g., `-f val1 -f val2` results in an array."
|
|
1074
1074
|
),
|
|
1075
1075
|
description: z.union([z.string(), z.array(z.string())]).optional().describe("Textual description for help messages."),
|
|
1076
|
+
valueHint: z.string().optional().describe("Hint/example value shown in help and examples."),
|
|
1076
1077
|
options: z.array(z.string().min(1)).min(1, "Flag must have at least one option (e.g., ['-f', '--flag'])").describe("Array of option strings, e.g., ['-f', '--flag']."),
|
|
1077
1078
|
defaultValue: z.any().optional().describe("Default value if the flag is not provided."),
|
|
1078
1079
|
type: z.union([
|
|
@@ -4250,6 +4251,35 @@ ${cyan("Flags:")}
|
|
|
4250
4251
|
typeName = flag["type"];
|
|
4251
4252
|
}
|
|
4252
4253
|
metaLines.push(`Type: ${typeName}`);
|
|
4254
|
+
{
|
|
4255
|
+
let isRepeatable = false;
|
|
4256
|
+
try {
|
|
4257
|
+
if (typeof flag["type"] === "function" && flag["type"].name === "Array") {
|
|
4258
|
+
isRepeatable = true;
|
|
4259
|
+
}
|
|
4260
|
+
const anyType = flag["type"];
|
|
4261
|
+
if (anyType && typeof anyType === "object" && anyType._def && anyType._def.typeName === "ZodArray") {
|
|
4262
|
+
isRepeatable = true;
|
|
4263
|
+
}
|
|
4264
|
+
if (flag["allowMultiple"]) isRepeatable = true;
|
|
4265
|
+
} catch {
|
|
4266
|
+
}
|
|
4267
|
+
const primaryOpt = flag["options"].find((o) => o.startsWith("--")) ?? flag["options"][0];
|
|
4268
|
+
const valueHint = flag["valueHint"];
|
|
4269
|
+
if (!flag["flagOnly"]) {
|
|
4270
|
+
if (isRepeatable) {
|
|
4271
|
+
metaLines.push("Multiple values allowed (repeat flag)");
|
|
4272
|
+
const v1 = valueHint ?? "value1";
|
|
4273
|
+
const v2 = valueHint ?? "value2";
|
|
4274
|
+
metaLines.push(
|
|
4275
|
+
`Example: ${primaryOpt} ${v1} ${primaryOpt} ${v2}`
|
|
4276
|
+
);
|
|
4277
|
+
} else {
|
|
4278
|
+
const v = valueHint ?? "value";
|
|
4279
|
+
metaLines.push(`Example: ${primaryOpt} ${v}`);
|
|
4280
|
+
}
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4253
4283
|
if (typeDetails.length > 0) {
|
|
4254
4284
|
metaLines.push(...typeDetails);
|
|
4255
4285
|
}
|