Fix PowerShell parameter conflicts by renaming Verbose to VerboseOutput

- Fixed parameter conflicts in sf-data-export.ps1, sf-data-import.ps1, sf-retrieve.ps1, and sf-test-run.ps1
- Renamed conflicting \ parameter to \ to avoid conflicts with PowerShell's built-in -Verbose common parameter
- Added proper parameter sets to ensure -Help parameter works correctly in all scripts
- Added -hp aliases where needed for consistency across all scripts
- All scripts now properly support help functionality without parameter conflicts

This resolves issues where scripts would fail with 'A parameter with the name Verbose was defined multiple times' error.
This commit is contained in:
Reynold Lariza
2025-08-28 20:58:54 +08:00
parent 159ede3794
commit 134169a2ee
4 changed files with 102 additions and 20 deletions

View File

@@ -35,7 +35,7 @@
.PARAMETER IgnoreErrors
Continue on errors (don't fail entire job) (alias: -ie)
.PARAMETER Verbose
.PARAMETER VerboseOutput
Enable verbose output (alias: -ve)
.PARAMETER Help
@@ -57,39 +57,48 @@
#>
param(
[Parameter(Mandatory)]
[Parameter(ParameterSetName="Import", Mandatory)]
[Alias("fl")]
[string]$File,
[Parameter(Mandatory)]
[Parameter(ParameterSetName="Import", Mandatory)]
[Alias("so")]
[string]$SObject,
[Parameter(ParameterSetName="Import")]
[ValidateSet("insert", "update", "upsert")]
[Alias("op")]
[string]$Operation = "insert",
[Parameter(ParameterSetName="Import")]
[Alias("ei")]
[string]$ExternalId,
[Parameter(ParameterSetName="Import")]
[Alias("to")]
[string]$TargetOrg,
[Parameter(ParameterSetName="Import")]
[Alias("bk")]
[switch]$Bulk,
[Parameter(ParameterSetName="Import")]
[Alias("wt")]
[int]$Wait = 10,
[Parameter(ParameterSetName="Import")]
[Alias("bs")]
[int]$BatchSize = 10000,
[Parameter(ParameterSetName="Import")]
[Alias("ie")]
[switch]$IgnoreErrors,
[Alias("vb")]
[switch]$Verbose,
[Parameter(ParameterSetName="Import")]
[Alias("ve")]
[switch]$VerboseOutput,
[Parameter(ParameterSetName="Help", Mandatory=$true)]
[Alias("hp")]
[switch]$Help
)
@@ -270,7 +279,7 @@ switch ($fileFormat) {
}
# Show file preview if verbose
if ($Verbose) {
if ($VerboseOutput) {
Show-FilePreview $File $fileFormat
}
@@ -312,7 +321,7 @@ if ($IgnoreErrors) {
}
# Add verbose flag if requested
if ($Verbose) {
if ($VerboseOutput) {
$sfArgs += "--verbose"
}
@@ -349,7 +358,7 @@ try {
}
}
if ($Verbose) {
if ($VerboseOutput) {
Write-Host "💡 Check the output above for detailed results and any warnings" -ForegroundColor Yellow
}
} else {