sywac (So You Want A CLI) is a Node.js library for parsing command-line arguments and building robust CLIs. It provides a fluid, asynchronous API for defining positional arguments, options, and complex nested commands, with features like type-based argument parsing and flexible auto-generated help content. The current stable version is 1.3.0. While its release cadence has been moderate, it remains an active project, most notably adding a `.strict()` mode in v1.3.0 for enhanced security against unknown flags. This differentiator helps prevent unexpected behavior from typos in sensitive operations. sywac is designed for Node.js environments (v4+) and focuses on a coherent API for both simple and complex CLI applications.
npm install sywacVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates defining commands, options, enabling strict mode, and parsing arguments using the `parseAndExit` method, showing how unknown flags are handled.
Upgrade to sywac v1.2.2 or higher to resolve validation message formatting on Node.js 12+.
Enable strict mode by calling `.strict()` in your CLI definition (available since v1.3.0) to ensure that unknown flags or arguments cause an error.
Always `await` the result of `cli.parseAndExit()` or `cli.parse()`. Ensure all custom `run` functions and validators are designed to handle asynchronous operations correctly, using `async/await` where necessary.
Upgrade sywac to v1.2.2 or a newer version to fix the display of validation messages.
If the flag is legitimate, add its definition to your sywac configuration using `.option()` or `.positional()`. If the flag is indeed an error, the strict mode is working as intended; guide users to correct their input or disable strict mode if this behavior is not desired.
Ensure you are using `const cli = require('sywac')` for importing the library, as sywac is distributed as a CommonJS module. Verify that `cli` is correctly instantiated before calling its methods.No dependency data recorded yet.