Problem description
PR #560 landed with a Write-Verbose auto-switch in Sampler/Public/New-SampleModule.ps1:
if ($PSBoundParameters.ContainsKey('Features') -and -not $PSBoundParameters.ContainsKey('ModuleType'))
{
Write-Verbose -Message ('Features parameter is only effective when ModuleType is CustomModule. Switching ModuleType to CustomModule to honor the selected features.')
$ModuleType = 'CustomModule'
}
Two remaining gaps from the original review:
- The behavior is not discoverable from
Get-Help New-SampleModule -Parameter Features. The .PARAMETER Features block lists valid values but does not mention that supplying -Features without -ModuleType defaults -ModuleType to CustomModule.
Write-Verbose is silent unless the caller passes -Verbose, so a user who does not ask for verbose output still gets a silently coerced ModuleType. Write-Warning is the usual pattern for "we changed your input" paths.
Gael indicated in #560 that the longer-term fix is to rework the Plaster Condition logic so -Features works with any template, at which point the auto-switch can go away entirely. This issue tracks the small interim improvements in case that larger rework does not land before the next full release.
Verbose logs
N/A
How to reproduce
Get-Help New-SampleModule -Parameter Features — note that the auto-switch is not mentioned.
New-SampleModule -DestinationPath . -ModuleName X -ModuleDescription Y -CustomRepo PSGallery -Features git,UnitTests (without -Verbose) — note that ModuleType is silently coerced to CustomModule with no console output.
Expected behavior
.PARAMETER Features help explicitly documents the auto-switch.
- The user gets some form of visible signal when the auto-switch fires, unless the "features-with-any-template" rework removes the need for it.
Current behavior
Behavior is documented only in the wiki tip box and is signalled only via Write-Verbose.
Suggested solution
- Add a sentence to
.PARAMETER Features in Sampler/Public/New-SampleModule.ps1.
- Consider replacing
Write-Verbose with Write-Warning, or remove the auto-switch entirely as part of the template-condition rework.
Operating system the target node is running
N/A
PowerShell version and build the target node is running
N/A
Module version used
Sampler Unreleased / post-#560.
Problem description
PR #560 landed with a
Write-Verboseauto-switch inSampler/Public/New-SampleModule.ps1:Two remaining gaps from the original review:
Get-Help New-SampleModule -Parameter Features. The.PARAMETER Featuresblock lists valid values but does not mention that supplying-Featureswithout-ModuleTypedefaults-ModuleTypetoCustomModule.Write-Verboseis silent unless the caller passes-Verbose, so a user who does not ask for verbose output still gets a silently coercedModuleType.Write-Warningis the usual pattern for "we changed your input" paths.Gael indicated in #560 that the longer-term fix is to rework the Plaster
Conditionlogic so-Featuresworks with any template, at which point the auto-switch can go away entirely. This issue tracks the small interim improvements in case that larger rework does not land before the next full release.Verbose logs
N/A
How to reproduce
Get-Help New-SampleModule -Parameter Features— note that the auto-switch is not mentioned.New-SampleModule -DestinationPath . -ModuleName X -ModuleDescription Y -CustomRepo PSGallery -Features git,UnitTests(without-Verbose) — note thatModuleTypeis silently coerced toCustomModulewith no console output.Expected behavior
.PARAMETER Featureshelp explicitly documents the auto-switch.Current behavior
Behavior is documented only in the wiki tip box and is signalled only via
Write-Verbose.Suggested solution
.PARAMETER FeaturesinSampler/Public/New-SampleModule.ps1.Write-VerbosewithWrite-Warning, or remove the auto-switch entirely as part of the template-condition rework.Operating system the target node is running
N/A
PowerShell version and build the target node is running
N/A
Module version used
Sampler
Unreleased/ post-#560.