- e0afa2f: handle circuit breaker (--help and --version) before parsing arguments
-
87565b2: Added onMissing callback support to flags, options, and custom types
That allows providing dynamic fallback values when command-line arguments are not provided, This enables:
- Hiding default values from help output
- Interactive prompts: Ask users for input when flags/options are missing
- Environment-based defaults: Check environment variables or config files dynamically
- Auto-discovery: Automatically find files or resources when not specified
- Async support: Handle both synchronous and asynchronous fallback logic
The onMissing callback is used as a fallback when defaultValue is not provided, following the precedence order: environment variables → defaultValue → onMissing → type defaults.
New APIs:
- flag({ onMissing: () => boolean | Promise })
- option({ onMissing: () => T | Promise })
- multioption({ onMissing: () => T[] | Promise<T[]> })
- Custom Type interface now supports onMissing property
- 46bf4a7: fix: properly reconstruct original argument strings in rest combinator
- a1afb05: --help exits with statuscode 0
- dfeafc8: add
defaultValueconfiguration @multioption
- 5867a13: Allow dangling forcePositionals
- 2f651de: Display help when calling subcommands without any arguments
- e05e433: Allow readonly T[] in oneOf
- 6cb8d08: upgrade all deps