zod-args-parser 1.0.8 → 1.0.10
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/LICENSE +21 -21
- package/lib/commonjs/autocomplete.js +40 -3
- package/lib/commonjs/autocomplete.js.map +1 -1
- package/lib/commonjs/help.js +1 -1
- package/lib/commonjs/help.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/parser.js +1 -1
- package/lib/commonjs/parser.js.map +1 -1
- package/lib/commonjs/utils.js +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/autocomplete.js +40 -3
- package/lib/module/autocomplete.js.map +1 -1
- package/lib/module/help.js +1 -1
- package/lib/module/help.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/parser.js +1 -1
- package/lib/module/parser.js.map +1 -1
- package/lib/module/utils.js +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/autocomplete.d.ts +9 -0
- package/lib/typescript/autocomplete.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +2 -0
- package/lib/typescript/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/autocomplete.ts +64 -1
- package/src/index.ts +84 -84
- package/src/parser.ts +1 -1
- package/src/types.ts +333 -333
- package/src/utils.ts +7 -2
package/src/utils.ts
CHANGED
|
@@ -20,13 +20,18 @@ export function transformOptionToArg(name: string): string {
|
|
|
20
20
|
|
|
21
21
|
/** - Check if an arg string is a short arg. E.g. `-i` -> `true` */
|
|
22
22
|
export function isFlagArg(name: string): boolean {
|
|
23
|
-
return /^-[a-z]$/.test(name);
|
|
23
|
+
return /^-[A-Z-a-z]$/.test(name);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** - Check if an arg string is a long arg. E.g. `--input-dir` -> `true` */
|
|
27
|
+
export function isLongArg(name: string): boolean {
|
|
28
|
+
return /^--[A-Z-a-z-]+[A-Z-a-z]$/.test(name);
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
/** - Check if an arg string is an options arg. E.g. `--input-dir` -> `true` , `-i` -> `true` */
|
|
27
32
|
export function isOptionArg(name: string | boolean): boolean {
|
|
28
33
|
if (typeof name !== "string") return false;
|
|
29
|
-
return isFlagArg(name) || name
|
|
34
|
+
return isFlagArg(name) || isLongArg(name);
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
/**
|