Parse an array of CLI argument strings into a typed CLIOptions object.
Supports the canonical flags --help / -h, --version / -v, --health, and the --timeout <ms> value flag.
--help
-h
--version
-v
--health
--timeout <ms>
Array of raw argument strings (typically process.argv.slice(2))
process.argv.slice(2)
Typed CLI options with boolean flags and optional timeout
const opts = parseCLIArgs(['--health']);if (opts.health) showHealth(); Copy
const opts = parseCLIArgs(['--health']);if (opts.health) showHealth();
const opts = parseCLIArgs(['--timeout', '90000']);// opts.timeout === 90000 Copy
const opts = parseCLIArgs(['--timeout', '90000']);// opts.timeout === 90000
Parse an array of CLI argument strings into a typed CLIOptions object.
Supports the canonical flags
--help/-h,--version/-v,--health, and the--timeout <ms>value flag.