getopts
getopts copied to clipboard
Node.js CLI options parser
If I understand correctly, the TypeScript types are for the CommonJS version of the code. When using `"module": "ES2022"` in `tsconfig.json` with `allowSyntheticDefaultImports: false`, importing `getopts` fails unless the type...
Currently it is very unclear which Node versions are supported. CI is executed on 12 and 14, but quick glance at a source code seems to indicate that it is...
`getopts` assigns default values to string (`''`), number (`0`) and boolean (`false`) options. Issues: 1. Not compatible with JS default values: ```js const { foo = 'bar' } = getopts(argv,...
Boolean options are considering any value as `true`. For example, let's consider an application that runs scripts by default and the user can filter the script to run: ```javascript {...
It would set the property to an array regardless if one flag is passed or multiple flags are passed. ```js getopts(["-t", "lunch"], { array: ["t"] }) //=> { t: ["lunch"]...