Allow skipping the Action argument

This commit is contained in:
Manuel Thalmann 2024-08-08 02:56:28 +02:00
parent d91beaae7b
commit 16f3c72eb3

View file

@ -149,10 +149,18 @@ $null = New-Module {
[scriptblock] $Installer = { }, [scriptblock] $Installer = { },
[scriptblock] $Configurator = { }, [scriptblock] $Configurator = { },
[scriptblock] $UserConfigurator = { }, [scriptblock] $UserConfigurator = { },
[InstallerAction] $Action = [InstallerAction]::Install, [Nullable[InstallerAction]] $Action,
[hashtable] $Arguments [hashtable] $Arguments
) )
[InstallerAction] $Action = & {
if ($Action.HasValue) {
$Action;
} else {
[InstallerAction]::Install;
}
};
if (-not $Name) { if (-not $Name) {
$Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName)); $Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName));
} }