Private/PivTool/ConvertTo-PWSHYBKPIVParameterName.ps1

function ConvertTo-PWSHYBKPIVParameterName {
    <#
    .SYNOPSIS
        Converts a cmdletWrapping.options catalog key to its PowerShell parameter name.
    .DESCRIPTION
        The JSON config's option keys are camelCase (e.g. "pinPolicy", "toSlot"). PowerShell
        parameter names are PascalCase (e.g. -PinPolicy, -ToSlot). This is a plain
        capitalize-first-letter transform - every current option key is a simple camelCase
        identifier with no embedded acronyms, so no special-casing is required for casing.

        One collision does need special-casing: PowerShell's [CmdletBinding()] already adds a
        -Verbose common parameter (plus Debug/WhatIf/Confirm/ErrorAction/etc.), so the config's
        "verbose" option - meant to pass --verbose through to yubico-piv-tool.exe - would
        otherwise generate a dynamic parameter that collides with it and breaks parameter
        binding for every action that lists "verbose". Any option name that would produce one of
        PowerShell's reserved common-parameter names is prefixed with "Tool" instead (e.g.
        "verbose" -> "ToolVerbose").
    .PARAMETER Name
        The camelCase option key, e.g. "pinPolicy".
    .OUTPUTS
        String. The PascalCase parameter name, e.g. "PinPolicy".
    .EXAMPLE
        ConvertTo-PWSHYBKPIVParameterName -Name 'pinPolicy'
        Returns 'PinPolicy'.
    .EXAMPLE
        ConvertTo-PWSHYBKPIVParameterName -Name 'verbose'
        Returns 'ToolVerbose' (avoids colliding with PowerShell's -Verbose common parameter).
    #>

    [CmdletBinding()]
    [OutputType([string])]
    param(
        [Parameter(Mandatory)]
        [string] $Name
    )

    $reservedCommonParameterNames = @(
        'Verbose', 'Debug', 'ErrorAction', 'WarningAction', 'InformationAction',
        'ErrorVariable', 'WarningVariable', 'InformationVariable', 'OutVariable',
        'OutBuffer', 'PipelineVariable', 'WhatIf', 'Confirm'
    )

    $candidate = $Name.Substring(0, 1).ToUpperInvariant() + $Name.Substring(1)
    if ($reservedCommonParameterNames -contains $candidate) {
        "Tool$candidate"
    } else {
        $candidate
    }
}