From cb59d450b838d0e9108f2c75cba3754794335951 Mon Sep 17 00:00:00 2001 From: rulasg Date: Wed, 7 May 2025 15:51:34 +0200 Subject: [PATCH] feat: add Force parameter to Install-SfClient function for optional reinstallation of Salesforce CLI --- public/sfEnvironment.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/public/sfEnvironment.ps1 b/public/sfEnvironment.ps1 index a40a857..86c302d 100644 --- a/public/sfEnvironment.ps1 +++ b/public/sfEnvironment.ps1 @@ -42,7 +42,18 @@ function Test-NpmSetup{ function Install-SfClient{ [CmdletBinding(SupportsShouldProcess)] - param() + param( + [Parameter()][switch]$Force + ) + + # Run installaltion if Force is set + # This command allows to update the Salesforce CLI if already installed + if($Force){ + "Installing Salesforce CLI using npm..." | Write-MyHost + Invoke-MyCommand -Command SfCliInstall + } + + # Check if npm is installed # Check and Install for Salesforce CLI installed and install if not $sfversion = Invoke-MyCommand -Command SfCliVersion -ErrorAction SilentlyContinue