zod-args-parser 1.0.14 → 1.0.15

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Ahmed Alabsi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ahmed Alabsi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.printPreparedArguments=printPreparedArguments;var _utils=require("./utils.js");function printPreparedArguments(argsMetadata,c,longest){if(!argsMetadata.length)return;(0,_utils.print)(c.title(" ARGUMENTS "));(0,_utils.println)();for(const metadata of argsMetadata){const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const spacing=longest+2-metadata.name.length;const normalizeDesc=metadata.description.replace(/\n/g,"\n"+(0,_utils.indent)(longest+6)+c.punctuation("└"));(0,_utils.println)((0,_utils.indent)(2),c.argument(metadata.name),(0,_utils.indent)(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):c.optional(metadata.optional));if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+(0,_utils.indent)(longest+16));(0,_utils.println)((0,_utils.indent)(longest+5),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}(0,_utils.println)();}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.printPreparedArguments=printPreparedArguments;var _utils=require("./utils.js");function printPreparedArguments(argsMetadata,c,longest){if(!argsMetadata.length)return;(0,_utils.print)(c.title(" ARGUMENTS "));(0,_utils.println)();for(const metadata of argsMetadata){const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const spacing=longest+2-metadata.name.length;const normalizeDesc=metadata.description.replace(/\n/g,"\n"+(0,_utils.indent)(longest+6)+c.punctuation("└"));(0,_utils.println)((0,_utils.indent)(2),c.argument(metadata.name),(0,_utils.indent)(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):metadata.optional?c.optional("(optional)"):"");if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+(0,_utils.indent)(longest+16));(0,_utils.println)((0,_utils.indent)(longest+5),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}(0,_utils.println)();}
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","printPreparedArguments","argsMetadata","c","longest","length","print","title","println","metadata","defaultStr","defaultValue","defaultValueAsString","spacing","name","normalizeDesc","description","replace","indent","punctuation","argument","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-arguments.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { ArgumentMetadata } from \"../types.js\";\nimport type { PrintHelpColors } from \"./colors.js\";\n\nexport function printPreparedArguments(argsMetadata: ArgumentMetadata[], c: PrintHelpColors, longest: number) {\n if (!argsMetadata.length) return;\n\n print(c.title(\" ARGUMENTS \"));\n\n println();\n\n for (const metadata of argsMetadata) {\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const spacing = longest + 2 - metadata.name.length;\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 6) + c.punctuation(\"└\"));\n\n println(\n indent(2),\n c.argument(metadata.name),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : c.optional(metadata.optional),\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 16));\n println(indent(longest + 5), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"4HAAA,IAAAA,MAAA,CAAAC,OAAA,eAKO,QAAS,CAAAC,sBAAsBA,CAACC,Y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ACgB,WAAW,CAAC,GAAG,CAAC,CAAGhB,CAAC,CAACsB,YAAY,CAAC,UAAU,CAAC,CAAEtB,CAAC,CAACoB,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAC5G,CACF,CAEA,GAAAhB,cAAO,EAAC,CAAC,CACX","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require","printPreparedArguments","argsMetadata","c","longest","length","print","title","println","metadata","defaultStr","defaultValue","defaultValueAsString","spacing","name","normalizeDesc","description","replace","indent","punctuation","argument","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-arguments.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { ArgumentMetadata } from \"../types.js\";\nimport type { PrintHelpColors } from \"./colors.js\";\n\nexport function printPreparedArguments(argsMetadata: ArgumentMetadata[], c: PrintHelpColors, longest: number) {\n if (!argsMetadata.length) return;\n\n print(c.title(\" ARGUMENTS \"));\n\n println();\n\n for (const metadata of argsMetadata) {\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const spacing = longest + 2 - metadata.name.length;\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 6) + c.punctuation(\"└\"));\n\n println(\n indent(2),\n c.argument(metadata.name),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : metadata.optional ? c.optional(\"(optional)\") : \"\",\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 16));\n println(indent(longest + 5), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"4HAAA,IAAAA,MAAA,CAAAC,OAAA,eAKO,QAAS,CAAAC,sBAAsBA,CAACC,YAAgC,CAAEC,CAAkB,CAAEC,OAAe,CAAE,CAC5G,GAAI,CAACF,YAAY,CAACG,MAAM,CAAE,OAE1B,GAAAC,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AC,CAAEtB,CAAC,CAACoB,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAC5G,CACF,CAEA,GAAAhB,cAAO,EAAC,CAAC,CACX","ignoreList":[]}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.printOptions=printOptions;var _utils=require("./utils.js");function printOptions(optionsMetadata,c,longest){if(!optionsMetadata.length)return;(0,_utils.print)(c.title(" OPTIONS "));(0,_utils.println)();for(const metadata of optionsMetadata){const names=metadata.aliasesAsArgs.concat([metadata.nameAsArg]);const normalizeDesc=metadata.description.replace(/\n/g,"\n"+(0,_utils.indent)(longest+7)+c.punctuation("└"));const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const optLength=names.join(", ").length+metadata.placeholder.length;const spacing=longest+1-optLength;const coloredNames=names.map(name=>c.option(name)).join(c.punctuation(", "));(0,_utils.println)((0,_utils.indent)(2),coloredNames,c.placeholder(metadata.placeholder),(0,_utils.indent)(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):c.optional(metadata.optional));if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+(0,_utils.indent)(longest+17));(0,_utils.println)((0,_utils.indent)(longest+6),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}(0,_utils.println)();}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.printOptions=printOptions;var _utils=require("./utils.js");function printOptions(optionsMetadata,c,longest){if(!optionsMetadata.length)return;(0,_utils.print)(c.title(" OPTIONS "));(0,_utils.println)();for(const metadata of optionsMetadata){const names=metadata.aliasesAsArgs.concat([metadata.nameAsArg]);const normalizeDesc=metadata.description.replace(/\n/g,"\n"+(0,_utils.indent)(longest+7)+c.punctuation("└"));const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const optLength=names.join(", ").length+metadata.placeholder.length;const spacing=longest+1-optLength;const coloredNames=names.map(name=>c.option(name)).join(c.punctuation(", "));(0,_utils.println)((0,_utils.indent)(2),coloredNames,c.placeholder(metadata.placeholder),(0,_utils.indent)(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):metadata.optional?c.optional("(optional)"):"");if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+(0,_utils.indent)(longest+17));(0,_utils.println)((0,_utils.indent)(longest+6),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}(0,_utils.println)();}
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","printOptions","optionsMetadata","c","longest","length","print","title","println","metadata","names","aliasesAsArgs","concat","nameAsArg","normalizeDesc","description","replace","indent","punctuation","defaultStr","defaultValue","defaultValueAsString","optLength","join","placeholder","spacing","coloredNames","map","name","option","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-options.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { PrintHelpColors } from \"./colors.js\";\nimport type { OptionMetadata } from \"../types.js\";\n\nexport function printOptions(optionsMetadata: OptionMetadata[], c: PrintHelpColors, longest: number) {\n if (!optionsMetadata.length) return;\n\n print(c.title(\" OPTIONS \"));\n\n println();\n\n for (const metadata of optionsMetadata) {\n const names = metadata.aliasesAsArgs.concat([metadata.nameAsArg]);\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 7) + c.punctuation(\"└\"));\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const optLength = names.join(\", \").length + metadata.placeholder.length;\n const spacing = longest + 1 - optLength;\n\n const coloredNames = names.map(name => c.option(name)).join(c.punctuation(\", \"));\n\n println(\n indent(2),\n coloredNames,\n c.placeholder(metadata.placeholder),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : c.optional(metadata.optional),\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 17));\n println(indent(longest + 6), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"wGAAA,IAAAA,MAAA,CAAAC,OAAA,eAKO,QAAS,CAAAC,YAAYA,CAACC,eAAiC,CAAEC,CAAkB,CAAEC,OAAe,CAAE,CACnG,GAAI,CAACF,eAAe,CAACG,MAAM,CAAE,OAE7B,GAAAC,YAAK,EAACH,CAAC,CAACI,KAAK,CAAC,WAAW,CAAC,CAAC,CAE3B,GAAAC,cAAO,EAAC,CAAC,CAET,IAAK,KAAM,CAAAC,QAAQ,GAAI,CAAAP,eAAe,CAAE,CACtC,KAAM,CAAAQ,KAAK,CAAGD,QAAQ,CAACE,aAAa,CAACC,MAAM,CAAC,CAACH,QAAQ,CAACI,SAAS,CAAC,CAAC,CACjE,KAAM,CAAAC,aAAa,CAAGL,QAAQ,CAACM,WAAW,CAACC,OAAO,CAAC,KAAK,CAAE,IAAI,CAAG,GAAAC,aAAM,EAACb,OAAO,CAAG,CAAC,CAAC,CAAGD,CAAC,CAACe,WAAW,CAAC,GAAG,CAAC,CAAC,CAC1G,KAAM,CAAAC,UAAU,CACd,MAAO,CAAAV,QAAQ,CAACW,YAAY,GAAK,WAAW,CAAG,aAAaX,QAAQ,CAACY,oBAAoB,GAAG,CAAG,EAAE,CAEnG,KAAM,CAAAC,SAAS,CAAGZ,KAAK,CAACa,IAAI,CAAC,IAAI,CAAC,CAAClB,MAAM,CAAGI,QAAQ,CAACe,WAAW,CAACnB,MAAM,CACvE,KAAM,CAAAoB,OAAO,CAAGrB,OAAO,CAAG,CAAC,CAAGkB,SAAS,CAEvC,KAAM,CAAAI,YAAY,CAAGhB,KAAK,CAACiB,GAAG,CAACC,IAAI,EAAIzB,CAAC,CAAC0B,MAAM,CAACD,IAAI,CAAC,CAAC,CAACL,IAAI,CAACpB,CAAC,CAACe,WAAW,CAAC,IAAI,CAAC,CAAC,CAEhF,GAAAV,cAAO,EACL,GAAAS,aAAM,EAAC,CAAC,CAAC,CACTS,YAAY,CACZvB,CAAC,CAACqB,WAAW,CAACf,QAAQ,CAACe,WAAW,CAAC,CACnC,GAAAP,aAAM,EAACQ,OAAO,CAAC,CACftB,CAAC,CAACY,WAAW,CAACD,aAAa,CAAC,CAC5BK,UAAU,CAAGhB,CAAC,CAAC2B,OAAO,CAACX,UAAU,CAAC,CAAGhB,CAAC,CAAC4B,QAAQ,CAACtB,QAAQ,CAACsB,QAAQ,CACnE,CAAC,CAED,GAAItB,QAAQ,CAACuB,OAAO,CAAE,CACpB,KAAM,CAAAC,gBAAgB,CAAGxB,QAAQ,CAACuB,OAAO,CAAChB,OAAO,CAAC,KAAK,CAAE,IAAI,CAAG,GAAAC,aAAM,EAACb,OAAO,CAAG,EAAE,CAAC,CAAC,CACrF,GAAAI,cAAO,EAAC,GAAAS,aAAM,EAACb,OAAO,CAAG,CAAC,CAAC,CAAED,CAAC,CAACe,WAAW,CAAC,GAAG,CAAC,CAAGf,CAAC,CAAC+B,YAAY,CAAC,UAAU,CAAC,CAAE/B,CAAC,CAAC6B,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAC5G,CACF,CAEA,GAAAzB,cAAO,EAAC,CAAC,CACX","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require","printOptions","optionsMetadata","c","longest","length","print","title","println","metadata","names","aliasesAsArgs","concat","nameAsArg","normalizeDesc","description","replace","indent","punctuation","defaultStr","defaultValue","defaultValueAsString","optLength","join","placeholder","spacing","coloredNames","map","name","option","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-options.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { PrintHelpColors } from \"./colors.js\";\nimport type { OptionMetadata } from \"../types.js\";\n\nexport function printOptions(optionsMetadata: OptionMetadata[], c: PrintHelpColors, longest: number) {\n if (!optionsMetadata.length) return;\n\n print(c.title(\" OPTIONS \"));\n\n println();\n\n for (const metadata of optionsMetadata) {\n const names = metadata.aliasesAsArgs.concat([metadata.nameAsArg]);\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 7) + c.punctuation(\"└\"));\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const optLength = names.join(\", \").length + metadata.placeholder.length;\n const spacing = longest + 1 - optLength;\n\n const coloredNames = names.map(name => c.option(name)).join(c.punctuation(\", \"));\n\n println(\n indent(2),\n coloredNames,\n c.placeholder(metadata.placeholder),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : metadata.optional ? c.optional(\"(optional)\") : \"\",\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 17));\n println(indent(longest + 6), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"wGAAA,IAAAA,MAAA,CAAAC,OAAA,eAKO,QAAS,CAAAC,YAAYA,CAACC,eAAiC,CAAEC,CAAkB,CAAEC,OAAe,CAAE,CACnG,GAAI,CAACF,eAAe,CAACG,MAAM,CAAE,OAE7B,GAAAC,YAAK,EAACH,CAAC,CAACI,KAAK,CAAC,WAAW,CAAC,CAAC,CAE3B,GAAAC,cAAO,EAAC,CAAC,CAET,IAAK,KAAM,CAAAC,QAAQ,GAAI,CAAAP,eAAe,CAAE,CACtC,KAAM,CAAAQ,KAAK,CAAGD,QAAQ,CAACE,aAAa,CAACC,MAAM,CAAC,CAACH,QAAQ,CAACI,SAAS,CAAC,CAAC,CACjE,KAAM,CAAAC,aAAa,CAAGL,QAAQ,CAACM,WAAW,CAACC,OAAO,CAAC,KAAK,CAAE,IAAI,CAAG,GAAAC,aAAM,EAACb,OAAO,CAAG,CAAC,CAAC,CAAGD,CAAC,CAACe,WAAW,CAAC,GAAG,CAAC,CAAC,CAC1G,KAAM,CAAAC,UAAU,CACd,MAAO,CAAAV,QAAQ,CAAC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B,cAAO,EAAC,CAAC,CACX","ignoreList":[]}
@@ -1 +1 @@
1
- import{indent,print,println}from"./utils.js";export function printPreparedArguments(argsMetadata,c,longest){if(!argsMetadata.length)return;print(c.title(" ARGUMENTS "));println();for(const metadata of argsMetadata){const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const spacing=longest+2-metadata.name.length;const normalizeDesc=metadata.description.replace(/\n/g,"\n"+indent(longest+6)+c.punctuation("└"));println(indent(2),c.argument(metadata.name),indent(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):c.optional(metadata.optional));if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+indent(longest+16));println(indent(longest+5),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}println();}
1
+ import{indent,print,println}from"./utils.js";export function printPreparedArguments(argsMetadata,c,longest){if(!argsMetadata.length)return;print(c.title(" ARGUMENTS "));println();for(const metadata of argsMetadata){const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const spacing=longest+2-metadata.name.length;const normalizeDesc=metadata.description.replace(/\n/g,"\n"+indent(longest+6)+c.punctuation("└"));println(indent(2),c.argument(metadata.name),indent(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):metadata.optional?c.optional("(optional)"):"");if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+indent(longest+16));println(indent(longest+5),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}println();}
@@ -1 +1 @@
1
- {"version":3,"names":["indent","print","println","printPreparedArguments","argsMetadata","c","longest","length","title","metadata","defaultStr","defaultValue","defaultValueAsString","spacing","name","normalizeDesc","description","replace","punctuation","argument","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-arguments.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { ArgumentMetadata } from \"../types.js\";\nimport type { PrintHelpColors } from \"./colors.js\";\n\nexport function printPreparedArguments(argsMetadata: ArgumentMetadata[], c: PrintHelpColors, longest: number) {\n if (!argsMetadata.length) return;\n\n print(c.title(\" ARGUMENTS \"));\n\n println();\n\n for (const metadata of argsMetadata) {\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const spacing = longest + 2 - metadata.name.length;\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 6) + c.punctuation(\"└\"));\n\n println(\n indent(2),\n c.argument(metadata.name),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : c.optional(metadata.optional),\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 16));\n println(indent(longest + 5), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"AAAA,OAASA,MAAM,CAAEC,KAAK,CAAEC,OAAO,KAAQ,YAAY,CAKnD,MAAO,SAAS,CAAAC,sBAAsBA,CAACC,YAAgC,CAAEC,CAAkB,CAAEC,OAAe,CAAE,CAC5G,GAAI,CAACF,YAAY,CAACG,MAAM,CAAE,OAE1BN,KAAK,CAACI,CAAC,CAACG,KAAK,CAAC,aAAa,CAAC,CAAC,CAE7BN,OAAO,CAAC,CAAC,CAET,IAAK,KAAM,CAAAO,QAAQ,GAAI,CAAAL,YAAY,CAAE,CACnC,KAAM,CAAAM,UAAU,CACd,MAAO,CAAAD,QAAQ,CAACE,YAAY,GAAK,WAAW,CAAG,aAAaF,QAAQ,CAACG,oBAAoB,GAAG,CAAG,EAAE,CAEnG,KAAM,CAAAC,OAAO,CAAGP,OAAO,CAAG,CAAC,CAAGG,QAAQ,CAACK,IAAI,CAACP,MAAM,CAClD,KAAM,CAAAQ,aAAa,CAAGN,QAAQ,CAACO,WAAW,CAACC,OAAO,CAAC,KAAK,CAAE,IAAI,CAAGjB,MAAM,CAACM,OAAO,CAAG,CAAC,CAAC,CAAGD,CAAC,CAACa,WAAW,CAAC,GAAG,CAAC,CAAC,CAE1GhB,OAAO,CACLF,MAAM,CAAC,CAAC,CAAC,CACTK,CAAC,CAACc,QAAQ,CAACV,QAAQ,CAACK,IAAI,CAAC,CACzBd,MAAM,CAACa,OAAO,CAAC,CACfR,CAAC,CAACW,WAAW,CAACD,aAAa,CAAC,CAC5BL,UAAU,CAAGL,CAAC,CAACe,OAAO,CAACV,UAAU,CAAC,CAAGL,CAAC,CAACgB,QAAQ,CAACZ,QAAQ,CAACY,QAAQ,CACnE,CAAC,CAED,GAAIZ,QAAQ,CAACa,OAAO,CAAE,CACpB,KAAM,CAAAC,gBAAgB,CAAGd,QAAQ,CAACa,OAAO,CAACL,OAAO,CAAC,KAAK,CAAE,IAAI,CAAGjB,MAAM,CAACM,OAAO,CAAG,EAAE,CAAC,CAAC,CACrFJ,OAAO,CAACF,MAAM,CAACM,OAAO,CAAG,CAAC,CAAC,CAAED,CAAC,CAACa,WAAW,CAAC,GAAG,CAAC,CAAGb,CAAC,CAACmB,YAAY,CAAC,UAAU,CAAC,CAAEnB,CAAC,CAACiB,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAC5G,CACF,CAEArB,OAAO,CAAC,CAAC,CACX","ignoreList":[]}
1
+ {"version":3,"names":["indent","print","println","printPreparedArguments","argsMetadata","c","longest","length","title","metadata","defaultStr","defaultValue","defaultValueAsString","spacing","name","normalizeDesc","description","replace","punctuation","argument","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-arguments.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { ArgumentMetadata } from \"../types.js\";\nimport type { PrintHelpColors } from \"./colors.js\";\n\nexport function printPreparedArguments(argsMetadata: ArgumentMetadata[], c: PrintHelpColors, longest: number) {\n if (!argsMetadata.length) return;\n\n print(c.title(\" ARGUMENTS \"));\n\n println();\n\n for (const metadata of argsMetadata) {\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const spacing = longest + 2 - metadata.name.length;\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 6) + c.punctuation(\"└\"));\n\n println(\n indent(2),\n c.argument(metadata.name),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : metadata.optional ? c.optional(\"(optional)\") : \"\",\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 16));\n println(indent(longest + 5), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"AAAA,OAASA,MAAM,CAAEC,KAAK,CAAEC,OAAO,KAAQ,YAAY,CAKnD,MAAO,SAAS,CAAAC,sBAAsBA,CAACC,YAAgC,CAAEC,CAAkB,CAAEC,OAAe,CAAE,CAC5G,GAAI,CAACF,YAAY,CAACG,MAAM,CAAE,OAE1BN,KAAK,CAACI,CAAC,CAACG,KAAK,CAAC,aAAa,CAAC,CAAC,CAE7BN,OAAO,CAAC,CAAC,CAET,IAAK,KAAM,CAAAO,QAAQ,GAAI,CAAAL,YAAY,CAAE,CACnC,KAAM,CAAAM,UAAU,CACd,MAAO,CAAAD,QAAQ,CAACE,YAAY,GAAK,WAAW,CAAG,aAAaF,QAAQ,CAACG,oBAAoB,GAAG,CAAG,EAAE,CAEnG,KAAM,CAAAC,OAAO,CAAGP,OAAO,CAAG,CAAC,CAAGG,QAAQ,CAACK,IAAI,CAACP,MAAM,CAClD,KAAM,CAAAQ,aAAa,CAAGN,QAAQ,CAACO,WAAW,CAACC,OAAO,CAAC,KAAK,CAAE,IAAI,CAAGjB,MAAM,CAACM,OAAO,CAAG,CAAC,CAAC,CAAGD,CAAC,CAACa,WAAW,CAAC,GAAG,CAAC,CAAC,CAE1GhB,OAAO,CACLF,MAAM,CAAC,CAAC,CAAC,CACTK,CAAC,CAACc,QAAQ,CAACV,QAAQ,CAACK,IAAI,CAAC,CACzBd,MAAM,CAACa,OAAO,CAAC,CACfR,CAAC,CAACW,WAAW,CAACD,aAAa,CAAC,CAC5BL,UAAU,CAAGL,CAAC,CAACe,OAAO,CAACV,UAAU,CAAC,CAAGD,QAAQ,CAACY,QAAQ,CAAGhB,CAAC,CAACgB,QAAQ,CAAC,YAAY,CAAC,CAAG,EACtF,CAAC,CAED,GAAIZ,QAAQ,CAACa,OAAO,CAAE,CACpB,KAAM,CAAAC,gBAAgB,CAAGd,QAAQ,CAACa,OAAO,CAACL,OAAO,CAAC,KAAK,CAAE,IAAI,CAAGjB,MAAM,CAACM,OAAO,CAAG,EAAE,CAAC,CAAC,CACrFJ,OAAO,CAACF,MAAM,CAACM,OAAO,CAAG,CAAC,CAAC,CAAED,CAAC,CAACa,WAAW,CAAC,GAAG,CAAC,CAAGb,CAAC,CAACmB,YAAY,CAAC,UAAU,CAAC,CAAEnB,CAAC,CAACiB,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAC5G,CACF,CAEArB,OAAO,CAAC,CAAC,CACX","ignoreList":[]}
@@ -1 +1 @@
1
- import{indent,print,println}from"./utils.js";export function printOptions(optionsMetadata,c,longest){if(!optionsMetadata.length)return;print(c.title(" OPTIONS "));println();for(const metadata of optionsMetadata){const names=metadata.aliasesAsArgs.concat([metadata.nameAsArg]);const normalizeDesc=metadata.description.replace(/\n/g,"\n"+indent(longest+7)+c.punctuation("└"));const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const optLength=names.join(", ").length+metadata.placeholder.length;const spacing=longest+1-optLength;const coloredNames=names.map(name=>c.option(name)).join(c.punctuation(", "));println(indent(2),coloredNames,c.placeholder(metadata.placeholder),indent(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):c.optional(metadata.optional));if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+indent(longest+17));println(indent(longest+6),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}println();}
1
+ import{indent,print,println}from"./utils.js";export function printOptions(optionsMetadata,c,longest){if(!optionsMetadata.length)return;print(c.title(" OPTIONS "));println();for(const metadata of optionsMetadata){const names=metadata.aliasesAsArgs.concat([metadata.nameAsArg]);const normalizeDesc=metadata.description.replace(/\n/g,"\n"+indent(longest+7)+c.punctuation("└"));const defaultStr=typeof metadata.defaultValue!=="undefined"?`(default: ${metadata.defaultValueAsString})`:"";const optLength=names.join(", ").length+metadata.placeholder.length;const spacing=longest+1-optLength;const coloredNames=names.map(name=>c.option(name)).join(c.punctuation(", "));println(indent(2),coloredNames,c.placeholder(metadata.placeholder),indent(spacing),c.description(normalizeDesc),defaultStr?c.default(defaultStr):metadata.optional?c.optional("(optional)"):"");if(metadata.example){const normalizeExample=metadata.example.replace(/\n/g,"\n"+indent(longest+17));println(indent(longest+6),c.punctuation("└")+c.exampleTitle("Example:"),c.example(normalizeExample));}}println();}
@@ -1 +1 @@
1
- {"version":3,"names":["indent","print","println","printOptions","optionsMetadata","c","longest","length","title","metadata","names","aliasesAsArgs","concat","nameAsArg","normalizeDesc","description","replace","punctuation","defaultStr","defaultValue","defaultValueAsString","optLength","join","placeholder","spacing","coloredNames","map","name","option","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-options.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { PrintHelpColors } from \"./colors.js\";\nimport type { OptionMetadata } from \"../types.js\";\n\nexport function printOptions(optionsMetadata: OptionMetadata[], c: PrintHelpColors, longest: number) {\n if (!optionsMetadata.length) return;\n\n print(c.title(\" OPTIONS \"));\n\n println();\n\n for (const metadata of optionsMetadata) {\n const names = metadata.aliasesAsArgs.concat([metadata.nameAsArg]);\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 7) + c.punctuation(\"└\"));\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const optLength = names.join(\", \").length + metadata.placeholder.length;\n const spacing = longest + 1 - optLength;\n\n const coloredNames = names.map(name => c.option(name)).join(c.punctuation(\", \"));\n\n println(\n indent(2),\n coloredNames,\n c.placeholder(metadata.placeholder),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : c.optional(metadata.optional),\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 17));\n println(indent(longest + 6), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"AAAA,OAASA,MAAM,CAAEC,KAAK,CAAEC,OAAO,KAAQ,YAAY,CAKnD,MAAO,SAAS,CAAAC,YAAYA,CAACC,eAAiC,CAAEC,CAAkB,CAAEC,OAAe,CAAE,CACnG,GAAI,CAACF,eAAe,CAACG,MAAM,CAAE,OAE7BN,KAAK,CAACI,CAAC,CAACG,KAAK,CAAC,WAAW,CAAC,CAAC,CAE3BN,OAAO,CAAC,CAAC,CAET,IAAK,KAAM,CAAAO,QAAQ,GAAI,CAAAL,eAAe,CAAE,CACtC,KAAM,CAAAM,KAAK,CAAGD,QAAQ,CAACE,aAAa,CAACC,MAAM,CAAC,CAACH,QAAQ,CAACI,SAAS,CAAC,CAAC,CACjE,KAAM,CAAAC,aAAa,CAAGL,QAAQ,CAACM,WAAW,CAACC,OAAO,CAAC,KAAK,CAAE,IAAI,CAAGhB,MAAM,CAACM,OAAO,CAAG,CAAC,CAAC,CAAGD,CAAC,CAACY,WAAW,CAAC,GAAG,CAAC,CAAC,CAC1G,KAAM,CAAAC,UAAU,CACd,MAAO,CAAAT,QAAQ,CAACU,YAAY,GAAK,WAAW,CAAG,aAAaV,QAAQ,CAACW,oBAAoB,GAAG,CAAG,EAAE,CAEnG,KAAM,CAAAC,SAAS,CAAGX,KAAK,CAACY,IAAI,CAAC,IAAI,CAAC,CAACf,MAAM,CAAGE,QAAQ,CAACc,WAAW,CAAChB,MAAM,CACvE,KAAM,CAAAiB,OAAO,CAAGlB,OAAO,CAAG,CAAC,CAAGe,SAAS,CAEvC,KAAM,CAAAI,YAAY,CAAGf,KAAK,CAACgB,GAAG,CAACC,IAAI,EAAItB,CAAC,CAACuB,MAAM,CAACD,IAAI,CAAC,CAAC,CAACL,IAAI,CAACjB,CAAC,CAACY,WAAW,CAAC,IAAI,CAAC,CAAC,CAEhFf,OAAO,CACLF,MAAM,CAAC,CAAC,CAAC,CACTyB,YAAY,CACZpB,CAAC,CAACkB,WAAW,CAACd,QAAQ,CAACc,WAAW,CAAC,CACnCvB,MAAM,CAACwB,OAAO,CAAC,CACfnB,CAAC,CAACU,WAAW,CAACD,aAAa,CAAC,CAC5BI,UAAU,CAAGb,CAAC,CAACwB,OAAO,CAACX,UAAU,CAAC,CAAGb,CAAC,CAACyB,QAAQ,CAACrB,QAAQ,CAACqB,QAAQ,CACnE,CAAC,CAED,GAAIrB,QAAQ,CAACsB,OAAO,CAAE,CACpB,KAAM,CAAAC,gBAAgB,CAAGvB,QAAQ,CAACsB,OAAO,CAACf,OAAO,CAAC,KAAK,CAAE,IAAI,CAAGhB,MAAM,CAACM,OAAO,CAAG,EAAE,CAAC,CAAC,CACrFJ,OAAO,CAACF,MAAM,CAACM,OAAO,CAAG,CAAC,CAAC,CAAED,CAAC,CAACY,WAAW,CAAC,GAAG,CAAC,CAAGZ,CAAC,CAAC4B,YAAY,CAAC,UAAU,CAAC,CAAE5B,CAAC,CAAC0B,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAC5G,CACF,CAEA9B,OAAO,CAAC,CAAC,CACX","ignoreList":[]}
1
+ {"version":3,"names":["indent","print","println","printOptions","optionsMetadata","c","longest","length","title","metadata","names","aliasesAsArgs","concat","nameAsArg","normalizeDesc","description","replace","punctuation","defaultStr","defaultValue","defaultValueAsString","optLength","join","placeholder","spacing","coloredNames","map","name","option","default","optional","example","normalizeExample","exampleTitle"],"sourceRoot":"../../../src/help-message","sources":["print-options.ts"],"sourcesContent":["import { indent, print, println } from \"./utils.js\";\n\nimport type { PrintHelpColors } from \"./colors.js\";\nimport type { OptionMetadata } from \"../types.js\";\n\nexport function printOptions(optionsMetadata: OptionMetadata[], c: PrintHelpColors, longest: number) {\n if (!optionsMetadata.length) return;\n\n print(c.title(\" OPTIONS \"));\n\n println();\n\n for (const metadata of optionsMetadata) {\n const names = metadata.aliasesAsArgs.concat([metadata.nameAsArg]);\n const normalizeDesc = metadata.description.replace(/\\n/g, \"\\n\" + indent(longest + 7) + c.punctuation(\"└\"));\n const defaultStr =\n typeof metadata.defaultValue !== \"undefined\" ? `(default: ${metadata.defaultValueAsString})` : \"\";\n\n const optLength = names.join(\", \").length + metadata.placeholder.length;\n const spacing = longest + 1 - optLength;\n\n const coloredNames = names.map(name => c.option(name)).join(c.punctuation(\", \"));\n\n println(\n indent(2),\n coloredNames,\n c.placeholder(metadata.placeholder),\n indent(spacing),\n c.description(normalizeDesc),\n defaultStr ? c.default(defaultStr) : metadata.optional ? c.optional(\"(optional)\") : \"\",\n );\n\n if (metadata.example) {\n const normalizeExample = metadata.example.replace(/\\n/g, \"\\n\" + indent(longest + 17));\n println(indent(longest + 6), c.punctuation(\"└\") + c.exampleTitle(\"Example:\"), c.example(normalizeExample));\n }\n }\n\n println();\n}\n"],"mappings":"AAAA,OAASA,MAAM,CAAEC,KAAK,CAAEC,OAAO,KAAQ,YAAY,CAKnD,MAAO,SAAS,CAAAC,YAAYA,CAACC,eAAiC,CAAEC,CAAkB,CAAEC,OAAe,CAAE,CACnG,GAAI,CAACF,eAAe,CAACG,MAAM,CAAE,OAE7BN,KAAK,CAACI,CAAC,CAACG,KAAK,CAAC,WAAW,CAAC,CAAC,CAE3BN,OAAO,CAAC,CAAC,CAET,IAAK,KAAM,CAAAO,QAAQ,GAAI,CAAAL,eAAe,CAAE,CACtC,KAAM,CAAAM,KAAK,CAAGD,QAAQ,CAACE,aAAa,CAACC,MAAM,CAAC,CAACH,QA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CACrFJ,OAAO,CAACF,MAAM,CAACM,OAAO,CAAG,CAAC,CAAC,CAAED,CAAC,CAACY,WAAW,CAAC,GAAG,CAAC,CAAGZ,CAAC,CAAC4B,YAAY,CAAC,UAAU,CAAC,CAAE5B,CAAC,CAAC0B,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAC5G,CACF,CAEA9B,OAAO,CAAC,CAAC,CACX","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-args-parser",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "A strictly typed command-line arguments parser powered by Zod.",
5
5
  "author": "Ahmed ALABSI <alabsi91@gmail.com>",
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@ export function printPreparedArguments(argsMetadata: ArgumentMetadata[], c: Prin
22
22
  c.argument(metadata.name),
23
23
  indent(spacing),
24
24
  c.description(normalizeDesc),
25
- defaultStr ? c.default(defaultStr) : c.optional(metadata.optional),
25
+ defaultStr ? c.default(defaultStr) : metadata.optional ? c.optional("(optional)") : "",
26
26
  );
27
27
 
28
28
  if (metadata.example) {
@@ -27,7 +27,7 @@ export function printOptions(optionsMetadata: OptionMetadata[], c: PrintHelpColo
27
27
  c.placeholder(metadata.placeholder),
28
28
  indent(spacing),
29
29
  c.description(normalizeDesc),
30
- defaultStr ? c.default(defaultStr) : c.optional(metadata.optional),
30
+ defaultStr ? c.default(defaultStr) : metadata.optional ? c.optional("(optional)") : "",
31
31
  );
32
32
 
33
33
  if (metadata.example) {