What problem does it solve?
Adding and maintaining boolean flags in the update-config CLI handler can lead to inconsistent parsing, brittle JSON mutations, double-counted or missed settingsChanged increments, and missing unit tests that allow regressions.
Core Features & Use Cases
- Consistent Parsing: Use TryParseRequiredBoolean to extract and validate boolean CLI arguments and centrally manage settingsChanged increments.
- Safe JSON Mutation: Use GetOrCreateObject to navigate or create nested JSON sections and assign flag values to the appropriate path (examples include powerShellConfiguration.Performance, Authentication, and Function).
- Testable Changes: Require unit tests that supply flags, invoke the update-config flow, and assert the resulting JSON structure and values to ensure correctness.
- Use Case: Add an --enable-caching flag that updates config.powerShellConfiguration.Performance.enableCaching and increments SettingsChanged.
Quick Start
Run the update-config command with the desired --enable-caching flag and then inspect the configuration JSON to confirm the performance section contains enableCaching set to the expected boolean value.