process.argv is a lightweight and minimal CLI argument parser for Node.js. The current stable version is 1.0.0. While the package does not have a rapid release cadence, its GitHub repository shows copyright updates extending to 2024 and active CI workflows, indicating ongoing maintenance rather than abandonment. It differentiates itself from more feature-rich alternatives like `yargs` or `commander` by intentionally omitting common conveniences such as shortcut flags (e.g., `-f`), built-in help message generation, and space-separated argument values (e.g., `--foo bar`). Instead, it processes arguments strictly in the `--key=value` format, automatically handling nested object structures from hyphenated keys (e.g., `--bar-buz` maps to `config.bar.buz`). This design philosophy prioritizes a small footprint and explicit parsing logic, requiring developers to implement higher-level CLI features themselves.
npm install process.argvVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing CLI arguments into a typed configuration object, applying defaults, and accessing positional arguments. The example includes a `mockArgs` array for easy testing without actual CLI execution.
Always use the full, long-form argument names (e.g., `--verbose` instead of `-v`).
Implement custom help message display using standard Node.js I/O, as shown in the synopsis example in the README.
Ensure all option values are assigned using the `--key=value` syntax.
Avoid `.` in key names. For literal `-` or `=`, use URL encoding if truly necessary, but generally prefer keys without these special characters or adjust your expected object structure for hyphens.
Use a default import: `import argv from 'process.argv';` in ESM/TypeScript or `const argv = require('process.argv');` in CommonJS.Ensure all argument values are assigned using the equals sign: `--foo=bar`.
Avoid using `.` in argument key names. Consider using hyphens (`--my-option`) which will map to nested objects (`{ my: { option: value } }`).No dependency data recorded yet.