I have a script (let's call it caller.ps1) that invokes another script callee.ps1. In caller.ps1, I want to inspect some arguments and pass them on, along with some other arguments to callee.ps1
caller:
param (
[Parameter(Mandatory, ParameterSetName="ByA")][string]$a, // passthru
[Parameter(Mandatory, ParameterSetName="ByB")][string]$b, // passthru
// some more passthru parameters
[Parameter()][switch]$inspect, // inspect, then pass on
[Parameter()][switch]$consume // consume, do not pass on
)
callee:
param (
[Parameter(Mandatory, ParameterSetName="ByA")][string]$a,
[Parameter(Mandatory, ParameterSetName="ByB")][string]$b,
// some more parameters
[Parameter()][switch]$inspect
)
what's the best practice here? I have tried @args
but it looks like it's empty. I suppose that's because all the arguments are bound to names?
Since I have two ParameterSets "ByA" and "ByB", and a bunch of switch parameters, it'd be super clunky to inspect each one and compose a new argument list for callee. Is there an elegant way of doing this? Thanks.