argue-cli is a lightweight and strongly typed command-line argument parser designed specifically for Node.js environments. It provides a declarative API for defining expected arguments and options, including aliases and type assertions for option values. The current stable version is 2.1.0, with a recent major release (v2.0.0) indicating ongoing development, though a fixed release cadence isn't specified. Its key differentiators lie in its "thin" design, aiming for minimal overhead, and its robust TypeScript support, which enables compile-time checking of CLI argument parsing logic. This helps developers avoid common runtime errors associated with loosely typed argument parsers by enforcing argument structures and types upfront. It focuses on explicitly consuming arguments with methods like `read`, `expect`, and `end`, ensuring all arguments are processed or an error is thrown for unexpected input.
npm install argue-cliVerified import paths — ran on the pinned version, not inferred.
This example demonstrates parsing a command (`install` or `remove`), reading associated options with aliases and explicit types, and then extracting a final argument (e.g., a package name), ensuring no unhandled arguments remain.
Convert your project to use ES Modules (`"type": "module"` in `package.json` and `import` statements) or use dynamic `import()` where `require()` is unavoidable. Ensure your Node.js version is 14.0.0 or higher.
Always ensure your parsing logic accounts for optional arguments or conditions where `read()` or `expect()` might be called without an available argument. Consider wrapping calls in `try...catch` blocks for robust error handling.
Design your CLI parsing logic to explicitly handle all possible arguments using `read()`, `expect()`, or `readOptions()` before calling `end()`. If residual arguments are acceptable, you should avoid calling `end()` or process them explicitly beforehand.
Ensure your parsing logic is structured such that `read()` is only called when an argument is expected. You might need to check `process.argv.length` or adjust your `expect()` calls for optional arguments.
Review your CLI structure and parsing logic. All arguments passed to the script must be explicitly consumed by `read()`, `expect()`, or `readOptions()` before `end()` is called.
Ensure the argument provided on the command line matches the expected type for the `option` definition (e.g., `--port=123` for `Number`, not just `--port`).
No dependency data recorded yet.