PowerShell / Crescendo

a module for wrapping native applications in a PowerShell function and module
MIT License
397 stars 37 forks source link

Extend functions that implement classes for ParameterInfo and Command with additional parameter options #208

Open steviecoaster opened 8 months ago

steviecoaster commented 8 months ago

Summary of the new feature / enhancement

Based on the[ParameterInfo] source as an example, it would make sense to provide some additional parameters (or all of them) so a Crescendo module author can more completely construct things without additional code.

For example, dealing with parameters that require NoGap be set to $true currently requires something like this to be done:

$parameterInfo = New-ParameterInfo -Name MyParameter -OriginalName '--original-parameter-name'
$parameterInfo.NoGap = $true

Proposed technical implementation details (optional)

I propose that class members be added as parameters to available New-* functions so Crescendo module authors have less and cleaner code to write.

E.g. I'd like to see this work:

$piSplat = @{
Name = 'FancyParameter'
OriginalName = '--fancy-param'
Description = 'This describes the parameter'
DefaultValue = 'SomeDefault
NoGap = $true

New-ParameterInfo @piSplat

I"m happy to help here, if you want to tell me "PRs greatly appreciated!" :joy: