From 76ba329ad25a6d189e8d8ab465a5ccc7f9f22b96 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 8 Aug 2024 02:56:28 +0200 Subject: [PATCH] Allow skipping the `Action` argument --- scripts/Common/Scripts/Software.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/Common/Scripts/Software.ps1 b/scripts/Common/Scripts/Software.ps1 index bbc69bcb..88860230 100644 --- a/scripts/Common/Scripts/Software.ps1 +++ b/scripts/Common/Scripts/Software.ps1 @@ -149,10 +149,18 @@ $null = New-Module { [scriptblock] $Installer = { }, [scriptblock] $Configurator = { }, [scriptblock] $UserConfigurator = { }, - [InstallerAction] $Action = [InstallerAction]::Install, + [Nullable[InstallerAction]] $Action, [hashtable] $Arguments ) + [InstallerAction] $Action = & { + if ($Action.HasValue) { + $Action; + } else { + [InstallerAction]::Install; + } + }; + if (-not $Name) { $Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName)); }