cli-bool-flag-pattern

Community

Consistent boolean CLI flags for config

Authorusepowershell
Version1.0.0
Installs0

System Documentation

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.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: cli-bool-flag-pattern
Download link: https://github.com/usepowershell/PoshMcp/archive/main.zip#cli-bool-flag-pattern

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.