From 1ed3836c6168b0336c47f61d192520894bc9daae Mon Sep 17 00:00:00 2001 From: Reynold Lariza Date: Thu, 28 Aug 2025 21:07:00 +0800 Subject: [PATCH] Fix PowerShell scripts identified during comprehensive testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed sf-apex-run.ps1 parameter sets to allow proper help functionality - Fixed sf-data-export.ps1 to not pass unsupported --verbose flag to sf commands - Fixed sf-data-import.ps1 command structure to use correct sf data import bulk/tree commands - Removed --verbose flag from sf data commands as they don't support it - All scripts now properly work with their respective parameter combinations - Comprehensive testing completed with all functionality verified Testing results: ✅ sf-check.ps1 - Working correctly ✅ sf-org-info.ps1 - Working correctly ✅ sf-web-open.ps1 - Working correctly ✅ sf-apex-run.ps1 - Fixed parameter sets, now working ✅ sf-deploy.ps1 - Working correctly ✅ sf-dry-run.ps1 - Working correctly ✅ sf-data-export.ps1 - Fixed --verbose flag issue, now working ✅ sf-data-import.ps1 - Fixed command structure, now working ✅ sf-retrieve.ps1 - Working correctly ✅ sf-test-run.ps1 - Working correctly ✅ sf-logs-tail.ps1 - Working correctly ✅ sf-org-create.ps1 - Working correctly --- sf-apex-run.ps1 | 7 +++++++ sf-data-export.ps1 | 6 ++---- sf-data-import.ps1 | 16 ++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sf-apex-run.ps1 b/sf-apex-run.ps1 index cfdae72..4bad4e6 100644 --- a/sf-apex-run.ps1 +++ b/sf-apex-run.ps1 @@ -42,8 +42,15 @@ param( [Parameter(ParameterSetName="Code")] [string]$code, + [Parameter(ParameterSetName="File")] + [Parameter(ParameterSetName="Code")] [string]$to, + + [Parameter(ParameterSetName="File")] + [Parameter(ParameterSetName="Code")] [switch]$ve, + + [Parameter(ParameterSetName="Help", Mandatory=$true)] [switch]$hp ) diff --git a/sf-data-export.ps1 b/sf-data-export.ps1 index c11df42..b2eeb2a 100644 --- a/sf-data-export.ps1 +++ b/sf-data-export.ps1 @@ -262,10 +262,8 @@ if ($TargetOrg) { Write-Host "Output format: $Format" -ForegroundColor Cyan Write-Host "Output file: $Output" -ForegroundColor Cyan -# Add verbose flag if requested -if ($VerboseOutput) { - $sfArgs += "--verbose" -} +# Note: sf data commands don't support --verbose flag +# VerboseOutput only affects the script's own output (query preview) # Display export information Write-Host "" diff --git a/sf-data-import.ps1 b/sf-data-import.ps1 index a36d52d..865bf22 100644 --- a/sf-data-import.ps1 +++ b/sf-data-import.ps1 @@ -283,8 +283,14 @@ if ($VerboseOutput) { Show-FilePreview $File $fileFormat } -# Build the sf command -$sfArgs = @("data", $Operation, "--file", $File, "--sobject", $SObject) +# Build the sf command based on file format +if ($fileFormat -eq "csv") { + # Use bulk import for CSV files + $sfArgs = @("data", "import", "bulk", "--file", $File, "--sobject", $SObject) +} else { + # Use tree import for JSON files + $sfArgs = @("data", "import", "tree", "--files", $File) +} # Add optional parameters if ($TargetOrg) { @@ -320,10 +326,8 @@ if ($IgnoreErrors) { Write-Host "Ignoring individual record errors" -ForegroundColor Yellow } -# Add verbose flag if requested -if ($VerboseOutput) { - $sfArgs += "--verbose" -} +# Note: sf data import commands don't support --verbose flag +# VerboseOutput only affects the script's own output (file preview) # Display import information Write-Host ""