{"_id":"zodcli","_rev":"3-0596e6ed7211b3c8f631bceb132d4cdc","name":"zodcli","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"zodcli","version":"0.0.1","description":"A CLI parser built with Zod.","type":"module","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"prettier":"npx prettier --ignore-unknown --ignore-path=.gitignore .","lint:check":"npm run prettier -- --check","lint:fix":"npm run prettier -- --write","test":"npx vitest","build":"npx tsc","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/GregBrimble/zodcli.git"},"keywords":["zod","cli","command-line","argv","parser","typescript"],"author":{"name":"Greg Brimble","email":"developer@gregbrimble.com","url":"https://gregbrimble.com/"},"license":"MIT","bugs":{"url":"https://github.com/GregBrimble/zodcli/issues"},"homepage":"https://github.com/GregBrimble/zodcli#readme","volta":{"node":"16.19.1"},"dependencies":{"typescript":"^4.9.5"},"peerDependencies":{"zod":"^3.21.4"},"devDependencies":{"@types/node":"^18.15.3","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.2","tsm":"^2.3.0","vitest":"^0.29.2"},"gitHead":"73aec90ab80ae51bd83cdadd010863915327f098","_id":"zodcli@0.0.1","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-Q9HOciH8HlHqIDP5aO+hiY0AAN0IR0HAvd4xSfkRc4IWFRsNay/9vSQXpRmfnOxLscAzQcTGtTamR8DWUUAr6A==","shasum":"8798da83505faa113d8f3f74b9451bd1e7a02332","tarball":"https://registry.npmjs.org/zodcli/-/zodcli-0.0.1.tgz","fileCount":6,"unpackedSize":29286,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICCy1EfM9SMPcboE/U6gGK/TZzkCGA48OMYbPIbGuoB2AiBkBAHLai3XXu+zBSZcwCMAHroU/wwLaad48/HrQceQDA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkE3XqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqowBAAk/HvHaVjS/LVxFdKQePaekSnVL6E9/TleV6EBEmcKFsI08aw\r\nSI0oNvA2YoZwvz/P7SAsShW5rW1w91aXE2FN0DRsu66TSuMduaKY6PiTiKD5\r\nG+64CPWKGE3VRQ1HcMCtQuswsuQa452frx5rhv/0LgF61519xvFwnG0G+wDX\r\ndg6u2+yN2Df3xVq2XRo7KZeGycBID/wr0ktf644xlD4Alh1tKl9bBU5J05T3\r\nw3zIm1Z6OcwVbyZmt69JPtIv4CSwkee9YaO18CSHN8jcYe1sO0CYqINRL9l5\r\nDB2vj5O5aYIDXcezrPxEFrqdZmMWEiiHLTCw/cHvnRDVBE8Rhz4kxWcZPJV0\r\n0RqUDnYwIYXdfmr/r2mw/RkKJKwvsdGIcihWQOOLMxb2pwnoNyLeyhAwsK85\r\nPN6q6iBPlSwvijaPyOKoWQARsBsYb80qZyIJ8rNAyTt0d6vN74O37XNQwSzd\r\ndp+jjixjjnWrtbi3qpzQp94SbMqvsOvk2MPpqrpclvWIzPxUoY1wulseVOAa\r\nKAL249e14TqluVJeMwocxPzWY3ss72qFb6bnuMscUHgW+fTYTUAdKJTeXML2\r\npSzCS26E8YTUxz1cd4RHl7y29EB5G+LO7chzX9gGdZMdekeE7CdC90gSuG3W\r\ntC9L37T8b4ZA+QvL+xdHXcsiJFFHldYxM28=\r\n=qAOD\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregbrimble","email":"developer@gregbrimble.com"},"directories":{},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zodcli_0.0.1_1678996970737_0.3624857240932229"},"_hasShrinkwrap":false},"0.0.2":{"name":"zodcli","version":"0.0.2","description":"A CLI parser built with Zod.","type":"module","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"prettier":"npx prettier --ignore-unknown --ignore-path=.gitignore .","lint:check":"npm run prettier -- --check","lint:fix":"npm run prettier -- --write","test":"npx vitest","build":"npx tsc","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/GregBrimble/zodcli.git"},"keywords":["zod","cli","command-line","argv","parser","typescript"],"author":{"name":"Greg Brimble","email":"developer@gregbrimble.com","url":"https://gregbrimble.com/"},"license":"MIT","bugs":{"url":"https://github.com/GregBrimble/zodcli/issues"},"homepage":"https://github.com/GregBrimble/zodcli#readme","volta":{"node":"16.19.1"},"dependencies":{"typescript":"^4.9.5"},"peerDependencies":{"zod":"^3.21.4"},"devDependencies":{"@types/node":"^18.15.3","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.2","tsm":"^2.3.0","vitest":"^0.29.2"},"gitHead":"202edfcd466512d0aef363d268d7798dd74cfbd5","_id":"zodcli@0.0.2","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-5538l3WiNUD71KTPO1OrPdco4B/XdSn4tw8GfmgOUdiLc1JIs7tmwMF3b7NeziJVR678bUh81Vc0B0o4PP3jnw==","shasum":"42a881f454288d6a7aabbcbf031038aadcb44c5a","tarball":"https://registry.npmjs.org/zodcli/-/zodcli-0.0.2.tgz","fileCount":6,"unpackedSize":25320,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOQiGj/oJU+UoObW55OX225JH1PIJtb650yp7MSu5+4wIgI3NR32f7hUt5oep9j6vMKKQuSkBPFBz3AEkGGx4JSFI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkE5LiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmorSBAAhHMJnvS8R2cWgAkJRpuxVCm4UdgE1NC5jOjPF16+swR+hE6w\r\no8dpogy2ed8NoCLpYLts3kmYsNAg6jyM02Wa4LTATE2nlUPo/+OalXDKlsAO\r\nog9G/0CUYN3GIFRTBAzX7Ij6s2hSULQmb9G6GwG8YbNGArIki4iEKWJltuHl\r\nWI2pmLEAR8dt3drpvcLwCeU79uvEvKwSC175SMG29P4kZdXuNIPNbM3fN2JE\r\nT0fjW50lrtn1U/KjeqPFiI7BUQnBgIX2oaDyzhYoeku/MPex098SadRXOp2p\r\nlCwDFFJhkK+XEO0hzOga+pWAYYmuMDyhgpLH7rlg0Et5aZQNJhF2JeOI6Gaj\r\nBe1G1plkKdIfW36WyZs8vKzbnu/92cyF7NSmQ1FFSPbvNq87XCCyUuJVnORR\r\nkgGutoHK6HSR5Bdv6Y78S0W4v6MGaugh+fz0Z6QxyheIcSVW6ImG61C8vW9y\r\n9KlJiYchk9ToFYdRe9S8AYff+33UfRO0CNtg56Bt2u9eA06WjumHxnNSQONr\r\nRr6R22OMcwO8Ka1Vz4N4Ts7Mfq1QGCN6fY57T7Upticnck5QwckCyM5F6Je3\r\nIS+nBiFaDsiq/DghedrkqnfUECqhbG0R5lQFLGRl846o1E51yRWzuSGR/WU8\r\n5RmDbad7AplFkcEEUN1qRoaLcqBFpX0e9kE=\r\n=X5yr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregbrimble","email":"developer@gregbrimble.com"},"directories":{},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zodcli_0.0.2_1679004386742_0.9301738137443016"},"_hasShrinkwrap":false},"0.0.3":{"name":"zodcli","version":"0.0.3","description":"A CLI parser built with Zod.","type":"module","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"prettier":"npx prettier --ignore-unknown --ignore-path=.gitignore .","lint:check":"npm run prettier -- --check","lint:fix":"npm run prettier -- --write","test":"npx vitest","build":"npx tsc","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/GregBrimble/zodcli.git"},"keywords":["zod","cli","command-line","argv","parser","typescript"],"author":{"name":"Greg Brimble","email":"developer@gregbrimble.com","url":"https://gregbrimble.com/"},"license":"MIT","bugs":{"url":"https://github.com/GregBrimble/zodcli/issues"},"homepage":"https://github.com/GregBrimble/zodcli#readme","volta":{"node":"16.19.1"},"dependencies":{"typescript":"^4.9.5"},"peerDependencies":{"zod":"^3.21.4"},"devDependencies":{"@types/node":"^18.15.3","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.2","tsm":"^2.3.0","vitest":"^0.29.2"},"gitHead":"14ff6efc497082e359fc535bca2368d118e7b971","_id":"zodcli@0.0.3","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-hktf0IR4VTUMg98+eWEzmbKCUg4LHrtBq8vZx778urIz26pkpeKUJNg4/mqZ+JcJK0ETQZ53PLtPZS+Enllwcg==","shasum":"b6008ccdd912cca7c994de9bf941cf3c3e1529e6","tarball":"https://registry.npmjs.org/zodcli/-/zodcli-0.0.3.tgz","fileCount":6,"unpackedSize":25690,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDX2iEr7dA7T6Lmd6yrU3N033Q7w/qOoA8v4NnwkXXEJAiAAwkjV+/cX/0ws7zvPruof9DJCc/rGCkH+u+toEQt0Og=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkE7dfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEYA/8CbKev7AdoYTQJrcgGQUTG1YlnRGSH43lhmtHCGlkPKNeKxtO\r\nUM2JiWUkBfUnDAj0oaI3l4c5z7lmLCHfg1k8fTFvnAuQaFW6g2ByutIW4k1m\r\nuFMWjvz9H70ayJm4ouUzKYd4UdNRRVMKD80tbwJI5/VxFqUryX/OR+aRKhTh\r\n8Yd22nd7pf/ioTOx0zCkLiLZIsnEdxYmp59FA7MW87ORxmUbVspF0IaibchM\r\n9NMyZReqb9lhreagLWq+bYxhRzfGUzgUe/8hu9cptV0HdBUHcDaPTb1/lxuS\r\nBWlcsiIDiNDaKXHGzTVhKi8GutPfZszCw381dQ982Jn8YrhCXjimopSm9kWd\r\ng3+GLBge6LhsxornequH5J32GW0zmIoKikyEyE/0LwyexNTchnOOQZZfOUsQ\r\n2da4EsX6jNfEs+WlSni69WxeDs/M7lCs+PHMLTW2rF7ItMNbNeCGKoZjLFBC\r\n4fOaK1GMn/veyWbCCqeyvkTnT5G4AmfXf/n5zJGPv48rIvRxjKRa48lpGotE\r\nAcfqX7xBMzccenESy4Ve204tMPyAaslEZMbBUvnVcGlFvV0vT3zXiR5IaQBn\r\n+uRbNIDBTY3y7PyiCe2g42XpUKNaKkIfm3nsK+7mpWSLeyvtqrcSO13S+ULo\r\n+6u6I7eKc5iDyOocRJulBYVgIHnWoGCmjpc=\r\n=v9S5\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregbrimble","email":"developer@gregbrimble.com"},"directories":{},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zodcli_0.0.3_1679013727177_0.6492583052736911"},"_hasShrinkwrap":false},"0.0.4":{"name":"zodcli","version":"0.0.4","description":"A CLI parser built with Zod.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"prettier":"npx prettier --ignore-unknown --ignore-path=.gitignore .","lint:check":"npm run prettier -- --check","lint:fix":"npm run prettier -- --write","test":"npx vitest","build":"npx tsc","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/GregBrimble/zodcli.git"},"keywords":["zod","cli","command-line","argv","parser","typescript"],"author":{"name":"Greg Brimble","email":"developer@gregbrimble.com","url":"https://gregbrimble.com/"},"license":"MIT","bugs":{"url":"https://github.com/GregBrimble/zodcli/issues"},"homepage":"https://github.com/GregBrimble/zodcli#readme","volta":{"node":"16.19.1"},"dependencies":{"typescript":"^4.9.5"},"peerDependencies":{"zod":"^3.21.4"},"devDependencies":{"@types/node":"^18.15.3","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.2","tsm":"^2.3.0","vitest":"^0.29.2"},"gitHead":"c176f70befaf895b19965eae0bc4d1b0a2211b8e","_id":"zodcli@0.0.4","_nodeVersion":"16.19.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-+WdBcf7Z19ueKI/w9SbxRXGyPnn5Fg/hc2nvOL3YKwcnhL2dvp58MvZwScvJS/Zqt4ePwSOLajboFG6su8BM8w==","shasum":"f778b9b0e0a7c2aa950d2e66aa1aa94dcdd59237","tarball":"https://registry.npmjs.org/zodcli/-/zodcli-0.0.4.tgz","fileCount":6,"unpackedSize":25688,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEUde9k5ExLsewVEtzPoM2o12el6p3xQeCPJsbuRrmx7AiEAnMhHCdck+KxmybWfA4UNRnmnaGLWE/hd2rdB2Y4ykAw="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkE7e7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqDrw//ZjD5dLQlAcYVjUwpcVlKJR+Sz8U1CM1lxfKbWQfm5Bwwje0A\r\nGCZntZFTXmIWgX0HxsixumL4mJRYvGoqg9B6ZgoGEY3C3svguSf9wLhn1Ek6\r\nuVfYahg9LeDS3pIMQfOLhis5wlBfqM/9nLxVYaZGaMKUwAxwXqsp+PFiNFUC\r\ne9w5YYR2pTJioEfSmaedweTEvf/QrxJBykgcAn6M+ZOxLjnMMGFOfw77hxJC\r\ngGLVEjiatyaH1tP6jAX0HTc2JunSKEOix1QMzVMV2utPW1DQ+sWQXUUm+Iyv\r\n8HTbu1m3RN2MQEaQpDUC5KNYu3W3bvJbcSqx9GxHoLqdLc5mhCrNz58UFo9i\r\nSOPhipg0wLYa++OF1jsV/2gqYtXnpoGD06v2tXb2N2A7HuAT8OrsY5FRVKLb\r\nnF4IuexHfcLYUzt3BSDEYYOjKqSqrKreapUWthkClFMctVbqqucdoU6JfxFs\r\nA82ouNN2uP8bSi3oapKPh3UXNzyzTSHtewHZbli9wADchWjE/4oRPOhKNxsg\r\nJo7qOOJ1c8XIBnr/YVjG+T+IfInwGiUa6HGz/qEMb5GcudWP3PMuSRqlgsrq\r\ndnPBg2EpQppI/Gu2ub2G+dhr08DQsJPsBXL3AqeG0FGX+z+OtVBTwpGBuzMH\r\nlE0uaEwRn2QHWuo48h+v40YHp8R1Q1XGmLE=\r\n=e5TI\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregbrimble","email":"developer@gregbrimble.com"},"directories":{},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zodcli_0.0.4_1679013819565_0.03767977946814671"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-16T20:02:50.644Z","0.0.1":"2023-03-16T20:02:50.960Z","modified":"2023-03-17T00:43:39.861Z","0.0.2":"2023-03-16T22:06:26.916Z","0.0.3":"2023-03-17T00:42:07.372Z","0.0.4":"2023-03-17T00:43:39.740Z"},"maintainers":[{"name":"gregbrimble","email":"developer@gregbrimble.com"}],"description":"A CLI parser built with Zod.","homepage":"https://github.com/GregBrimble/zodcli#readme","keywords":["zod","cli","command-line","argv","parser","typescript"],"repository":{"type":"git","url":"git+https://github.com/GregBrimble/zodcli.git"},"author":{"name":"Greg Brimble","email":"developer@gregbrimble.com","url":"https://gregbrimble.com/"},"bugs":{"url":"https://github.com/GregBrimble/zodcli/issues"},"license":"MIT","readme":"# zodcli\n\nA CLI parser built with Zod.\n\n## Getting Started\n\n```\nnpm install --save zodcli zod\n```\n\n```ts\nimport { z } from \"zod\";\nimport { argumentParser } from \"zodcli\";\n\nargumentParser({ options: z.object({ foo: z.string() }).strict() }).parse([\n\t\"--foo=bar\",\n]);\n```\n\n### Using in a CLI\n\nYou can get CLI arguments passed to the script by using `process.argv.slice(2)`:\n\n```ts\n// ./cli.js\n\nimport { z } from \"zod\";\nimport { argumentParser } from \"./dist/index.js\";\n\nconsole.log(\n\targumentParser({ options: z.object({ foo: z.string() }).strict() }).parse(\n\t\tprocess.argv.slice(2)\n\t)\n);\n\n// $ node cli.js --foo=bar\n// { foo: 'bar' }\n```\n\n## API\n\n### `argumentParser`\n\n`argumentParser` is a function which takes an object with the following properties: [`options`](#options) and [`aliases`](#aliases).\n\n#### `options`\n\n`options` is a required property and **must** have a value of a strict Zod object (`z.object({}).strict()`). This ensures that any unrecognized arguments are rejected.\n\n- All properties **must** be in ['camelCase'](https://en.wikipedia.org/wiki/Camel_case) and be exclusively composed of a-z characters. For example:\n\n  - Valid:\n    - `foo`\n    - `catDog`\n  - Invalid:\n    - `Foo`\n    - `cat_dog`\n    - `5`\n    - `a5`\n\n  When parsed, ['--kebab-case'](https://en.wikipedia.org/wiki/Letter_case#Kebab_case) arguments are converted to their respective 'camelCase' properties.\n\n  For example:\n\n  ```ts\n  import { z } from \"zod\";\n  import { argumentParser } from \"zodcli\";\n\n  const options = z\n  \t.object({\n  \t\tfoo: z.string(),\n  \t\tcatDog: z.string(),\n  \t})\n  \t.strict();\n\n  const result = argumentParser({\n  \toptions,\n  }).parse([\"--foo=bar\", \"--cat-dog=fish\"]);\n\n  console.log(result);\n  // { foo: 'bar', catDog: 'fish' }\n  ```\n\n- All values **must** be one of the following Zod types:\n\n  - [`z.literal()`](https://zod.dev/?id=literals)\n  - [`z.string()`](https://zod.dev/?id=strings)\n  - [`z.number()`](https://zod.dev/?id=numbers)\n  - [`z.null()`](https://zod.dev/?id=primitives)\n\n  And these values can be modified/wrapped with any of the following:\n\n  - [`.transform()`](https://zod.dev/?id=transform)\n  - [`.optional()`](https://zod.dev/?id=optional)\n  - [`.default()`](https://zod.dev/?id=default)\n  - [`z.union()`](https://zod.dev/?id=unions)\n  - [`z.array()`](https://zod.dev/?id=arrays)\n\n#### `aliases`\n\n`aliases` is an optional property which allows you to configure argument aliases for options. It is an object where: the properties are lowercase and composed of exclusively a-z charaters; and the values are 'camelCase' strings and appear as properties in the [`options`](#options) object.\n\n## Tips and Tricks\n\n### Parsing\n\nParsing requires an explict `=` between the argument name and its value. For example:\n\n- Valid:\n  - `--foo=bar --cat-dog=fish`\n- Invalid:\n  - `--foo bar --cat-dog fish`\n\n### Implicit Booleans\n\nIf an argument value is omitted, it will be set as `null`. You can use this to accept implicit booleans (boolean arguments whose presence implies `true`) by using a `z.union()`. For example:\n\n```ts\nimport { z } from \"zod\";\nimport { argumentParser } from \"zodcli\";\n\nconst options = z\n\t.object({\n\t\tfoo: z\n\t\t\t.union([\n\t\t\t\tz.literal(\"true\").transform(() => true),\n\t\t\t\tz.literal(\"false\").transform(() => false),\n\t\t\t\tz.null().transform(() => true),\n\t\t\t])\n\t\t\t.default(\"false\"),\n\t})\n\t.strict();\n\nconst result = argumentParser({\n\toptions,\n}).parse([\"--foo\"]);\n\nconsole.log(result);\n// { foo: true }\n```\n\n### Optional Options\n\nYou can make options optional by using the [`.optional()`](https://zod.dev/?id=optionals) modifier. For example:\n\n```ts\nimport { z } from \"zod\";\nimport { argumentParser } from \"zodcli\";\n\nconst options = z\n\t.object({\n\t\tfoo: z.string(),\n\t\tcatDog: z.string().optional(),\n\t})\n\t.strict();\n\nconst result = argumentParser({\n\toptions,\n}).parse([\"--foo=bar\"]);\n\nconsole.log(result);\n// { foo: 'bar' }\n```\n\nOr, to make all options optional, you can use [`.partial()`](https://zod.dev/?id=partial) on the object. For example:\n\n```ts\nimport { z } from \"zod\";\nimport { argumentParser } from \"zodcli\";\n\nconst options = z\n\t.object({\n\t\tfoo: z.string(),\n\t\tcatDog: z.string(),\n\t})\n\t.partial()\n\t.strict();\n\nconst result = argumentParser({\n\toptions,\n}).parse([\"--foo=bar\"]);\n\nconsole.log(result);\n// { foo: 'bar' }\n```\n\nNote, however, that for booleans, you will likely want to keep them required and simply provide a `.default()` false value. For example:\n\n```ts\nimport { z } from \"zod\";\nimport { argumentParser } from \"zodcli\";\n\nconst options = z\n\t.object({\n\t\tfoo: z\n\t\t\t.union([\n\t\t\t\tz.literal(\"true\").transform(() => true),\n\t\t\t\tz.literal(\"false\").transform(() => false),\n\t\t\t\tz.null().transform(() => true),\n\t\t\t])\n\t\t\t.default(\"false\"),\n\t\tcatDog: z.string(),\n\t})\n\t.partial()\n\t.required({ foo: true })\n\t.strict();\n\nconst result = argumentParser({\n\toptions,\n}).parse([]);\n\nconsole.log(result);\n// { foo: false }\n```\n\n### Coercion\n\nYou can [coerce non-string values using Zod](https://zod.dev/?id=coercion-for-primitives). For example:\n\n```ts\nimport { z } from \"zod\";\nimport { argumentParser } from \"zodcli\";\n\nconst options = z\n\t.object({\n\t\tfoo: z.coerce.number(),\n\t})\n\t.strict();\n\nconst result = argumentParser({\n\toptions,\n}).parse([\"--foo=2.2\"]);\n\nconsole.log(result);\n// { foo: 2.2 }\n```\n\n## Roadmap\n\n- [ ] Help message\n- [ ] Commands support\n- [ ] Positionals support\n- [ ] Object support\n- [x] Strict typing of aliases\n- [ ] Improve optionality/booleans\n","readmeFilename":"README.md"}