@lucasdinonolte/cli-flag-parser
v0.0.1
Published
A simple utility for making parsing command-line flags type-safe using zod.
Readme
CLI Flag Parser
A simple utility for making parsing command-line flags type-safe using zod.
Features
- Parses boolean and value flags
- Supports strict and passthrough modes for flag validation
- Integration with Zod for full type-safety
Installation
To get started, clone the repository and install the dependencies:
npm install @lucasdinonolte/cli-flag-parserUsage
Example
Here’s a basic example of how to use the CLI flag parser:
import { createParser } from '@lucasdinonolte/cli-flag-parser';
import { z } from 'zod';
const parser = createParser({
verbose: z.boolean().default(false),
output: z.string(),
});
const result = parser(process.argv.slice(2));