From 16f3c72eb3ec46805bb2173430a925ae9747ccb9 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 b0cbfa35..136cca04 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)); }