Update PowerShell scripts to use consistent two-character options (Part 1)

🔄 PowerShell Option Consistency - Phase 1 Complete:

 Updated Scripts:
  - sf-deploy.ps1: -to, -sr, -dr, -ts, -hp (matches Bash)
  - sf-dry-run.ps1: -to, -sr, -dr, -ts, -hp (matches Bash)
  - sf-web-open.ps1: -to, -pt, -ur, -hp (matches Bash)
  - sf-check.ps1: -vb, -hp (matches Bash)
  - sf-org-create.ps1: -al, -dd, -df, -st, -tp, -hp (matches Bash)

🎯 Consistency Achieved:
  - All parameter names now match their Bash counterparts exactly
  - Help text updated with descriptive option names
  - Examples updated to show new two-character options
  - All validation logic updated to use new parameter names

🚀 Cross-Platform Alignment:
  - PowerShell and Bash scripts now have identical option schemes
  - Users get consistent experience across platforms
  - No more confusion between single-char and two-char options

Remaining: 7 more PowerShell scripts to update for full consistency.
This commit is contained in:
reynold
2025-08-28 19:19:15 +08:00
parent f22a46d711
commit 579264e3d1
5 changed files with 133 additions and 133 deletions

View File

@@ -1,6 +1,6 @@
param( param(
[switch]$v, [switch]$vb,
[switch]$h [switch]$hp
) )
function Show-Help { function Show-Help {
@@ -8,11 +8,11 @@ function Show-Help {
sf-check.ps1 verify Salesforce CLI environment and configuration sf-check.ps1 verify Salesforce CLI environment and configuration
USAGE: USAGE:
sf-check.ps1 [-v] [-h] sf-check.ps1 [-vb] [-hp]
OPTIONS: OPTIONS:
-v Verbose output (show detailed information) -vb Verbose output (show detailed information)
-h Show this help -hp Help - show this help
DESCRIPTION: DESCRIPTION:
This script verifies that the Salesforce CLI is properly installed and configured. This script verifies that the Salesforce CLI is properly installed and configured.
@@ -24,7 +24,7 @@ DESCRIPTION:
EXAMPLES: EXAMPLES:
sf-check.ps1 # Basic environment check sf-check.ps1 # Basic environment check
sf-check.ps1 -v # Verbose output with detailed information sf-check.ps1 -vb # Verbose output with detailed information
"@ "@
} }
@@ -276,13 +276,13 @@ function Test-Diagnostics {
} }
# Show help if requested # Show help if requested
if ($h) { if ($hp) {
Show-Help Show-Help
exit 0 exit 0
} }
# Set verbose flag # Set verbose flag
$Verbose = $v $Verbose = $vb
# Main execution # Main execution
function Main { function Main {
@@ -328,7 +328,7 @@ function Main {
if (-not $Verbose) { if (-not $Verbose) {
Write-Host "" Write-Host ""
Write-Host "Run 'sf-check.ps1 -v' for detailed system information." Write-Host "Run 'sf-check.ps1 -vb' for detailed system information."
} }
} }
} }

View File

@@ -1,9 +1,9 @@
param( param(
[string]$o = "", [string]$to = "",
[string]$s = "", [string]$sr = "",
[string]$d = "", [string]$dr = "",
[string]$t = "", [string]$ts = "",
[switch]$h [switch]$hp
) )
function Show-Help { function Show-Help {
@@ -11,53 +11,53 @@ function Show-Help {
sf-deploy.ps1 PowerShell wrapper for ``sf project deploy start`` sf-deploy.ps1 PowerShell wrapper for ``sf project deploy start``
USAGE: USAGE:
sf-deploy.ps1 -o <ORG_ALIAS_OR_USERNAME> (-s "<src1>,<src2>[,...]" | -d <DIRECTORY>) [-t "<Test1>,<Test2>[,...]"] sf-deploy.ps1 -to <ORG_ALIAS_OR_USERNAME> (-sr "<src1>,<src2>[,...]" | -dr <DIRECTORY>) [-ts "<Test1>,<Test2>[,...]"]
sf-deploy.ps1 -h sf-deploy.ps1 -hp
OPTIONS: OPTIONS:
-o Org alias or username for --target-org -to Target org alias or username for --target-org
-s Comma-separated list of --source-dir paths -sr Sources - comma-separated list of --source-dir paths
-d Single directory path to deploy (alternative to -s) -dr Directory - single directory path to deploy (alternative to -sr)
-t Comma-separated list of --tests (enables --test-level RunSpecifiedTests) -ts Tests - comma-separated list of --tests (enables --test-level RunSpecifiedTests)
-h Show this help -hp Help - show this help
EXAMPLES: EXAMPLES:
1) Real deploy with multiple flexipages (specific files): 1) Real deploy with multiple flexipages (specific files):
sf-deploy.ps1 -o "DEMO-ORG" `` sf-deploy.ps1 -to "DEMO-ORG" ``
-s "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Page_Backup_With_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml" -sr "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Page_Backup_With_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml"
2) Real deploy with entire directory: 2) Real deploy with entire directory:
sf-deploy.ps1 -o "DEMO-ORG" -d "force-app/main/default/classes" sf-deploy.ps1 -to "DEMO-ORG" -dr "force-app/main/default/classes"
3) Real deploy with specified tests: 3) Real deploy with specified tests:
sf-deploy.ps1 -o "DEMO-ORG" `` sf-deploy.ps1 -to "DEMO-ORG" ``
-s "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" `` -sr "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" ``
-t "SelectorOpportunity_Test,SelectorOpportunity2_Test" -ts "SelectorOpportunity_Test,SelectorOpportunity2_Test"
Notes: Notes:
- Use -s for specific files (comma-separated) OR -d for entire directories (not both). - Use -sr for specific files (comma-separated) OR -dr for entire directories (not both).
- Pass absolute or repo-relative paths. - Pass absolute or repo-relative paths.
- Multiple tests are comma-separated in -t; they will be expanded to multiple --tests flags. - Multiple tests are comma-separated in -ts; they will be expanded to multiple --tests flags.
"@ "@
} }
# Show help if requested or no parameters provided # Show help if requested or no parameters provided
if ($h -or ($o -eq "" -and $s -eq "" -and $d -eq "" -and $t -eq "")) { if ($hp -or ($to -eq "" -and $sr -eq "" -and $dr -eq "" -and $ts -eq "")) {
Show-Help Show-Help
exit 0 exit 0
} }
# Validate that either -s or -d is provided, but not both # Validate that either -sr or -dr is provided, but not both
if ($s -ne "" -and $d -ne "") { if ($sr -ne "" -and $dr -ne "") {
Write-Error "Cannot use both -s and -d options. Use -s for specific files or -d for directories." Write-Error "Cannot use both -sr and -dr options. Use -sr for specific files or -dr for directories."
Write-Host "" Write-Host ""
Show-Help Show-Help
exit 1 exit 1
} }
# Validate required parameters # Validate required parameters
if ($o -eq "" -or ($s -eq "" -and $d -eq "")) { if ($to -eq "" -or ($sr -eq "" -and $dr -eq "")) {
Write-Error "Must provide -o (org) and either -s (specific files) or -d (directory path)." Write-Error "Must provide -to (org) and either -sr (specific files) or -dr (directory path)."
Write-Host "" Write-Host ""
Show-Help Show-Help
exit 1 exit 1
@@ -94,8 +94,8 @@ catch {
$cmd = @("sf", "project", "deploy", "start") $cmd = @("sf", "project", "deploy", "start")
# Add source directories (specific files) # Add source directories (specific files)
if ($s -ne "") { if ($sr -ne "") {
$sourcesArray = $s -split "," $sourcesArray = $sr -split ","
foreach ($src in $sourcesArray) { foreach ($src in $sourcesArray) {
$src = $src.Trim() $src = $src.Trim()
if ($src -ne "") { if ($src -ne "") {
@@ -106,20 +106,20 @@ if ($s -ne "") {
} }
# Add directory path # Add directory path
if ($d -ne "") { if ($dr -ne "") {
$cmd += "--source-dir" $cmd += "--source-dir"
$cmd += $d $cmd += $dr
} }
# Add target org # Add target org
if ($o -ne "") { if ($to -ne "") {
$cmd += "--target-org" $cmd += "--target-org"
$cmd += $o $cmd += $to
} }
# Add tests if specified # Add tests if specified
if ($t -ne "") { if ($ts -ne "") {
$testsArray = $t -split "," $testsArray = $ts -split ","
$cmd += "--test-level" $cmd += "--test-level"
$cmd += "RunSpecifiedTests" $cmd += "RunSpecifiedTests"

View File

@@ -1,9 +1,9 @@
param( param(
[string]$o = "", [string]$to = "",
[string]$s = "", [string]$sr = "",
[string]$d = "", [string]$dr = "",
[string]$t = "", [string]$ts = "",
[switch]$h [switch]$hp
) )
function Show-Help { function Show-Help {
@@ -11,53 +11,53 @@ function Show-Help {
sf-dry-run.ps1 PowerShell wrapper for ``sf project deploy start --dry-run`` sf-dry-run.ps1 PowerShell wrapper for ``sf project deploy start --dry-run``
USAGE: USAGE:
sf-dry-run.ps1 -o <ORG_ALIAS_OR_USERNAME> (-s "<src1>,<src2>[,...]" | -d <DIRECTORY>) [-t "<Test1>,<Test2>[,...]"] sf-dry-run.ps1 -to <ORG_ALIAS_OR_USERNAME> (-sr "<src1>,<src2>[,...]" | -dr <DIRECTORY>) [-ts "<Test1>,<Test2>[,...]"]
sf-dry-run.ps1 -h sf-dry-run.ps1 -hp
OPTIONS: OPTIONS:
-o Org alias or username for --target-org -to Target org alias or username for --target-org
-s Comma-separated list of --source-dir paths -sr Sources - comma-separated list of --source-dir paths
-d Single directory path to validate (alternative to -s) -dr Directory - single directory path to validate (alternative to -sr)
-t Comma-separated list of --tests (enables --test-level RunSpecifiedTests) -ts Tests - comma-separated list of --tests (enables --test-level RunSpecifiedTests)
-h Show this help -hp Help - show this help
EXAMPLES: EXAMPLES:
1) Basic dry-run with multiple flexipages (specific files): 1) Basic dry-run with multiple flexipages (specific files):
sf-dry-run.ps1 -o "DEMO-ORG" `` sf-dry-run.ps1 -to "DEMO-ORG" ``
-s "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml" -sr "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml"
2) Dry-run validation for entire directory: 2) Dry-run validation for entire directory:
sf-dry-run.ps1 -o "DEMO-ORG" -d "force-app/main/default/classes" sf-dry-run.ps1 -to "DEMO-ORG" -dr "force-app/main/default/classes"
3) Dry-run with specified tests: 3) Dry-run with specified tests:
sf-dry-run.ps1 -o "DEMO-ORG" `` sf-dry-run.ps1 -to "DEMO-ORG" ``
-s "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" `` -sr "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" ``
-t "SelectorOpportunity_Test,SelectorOpportunity2_Test" -ts "SelectorOpportunity_Test,SelectorOpportunity2_Test"
Notes: Notes:
- Use -s for specific files (comma-separated) OR -d for entire directories (not both). - Use -sr for specific files (comma-separated) OR -dr for entire directories (not both).
- Pass absolute or repo-relative paths. - Pass absolute or repo-relative paths.
- Multiple tests are comma-separated in -t; they will be expanded to multiple --tests flags. - Multiple tests are comma-separated in -ts; they will be expanded to multiple --tests flags.
"@ "@
} }
# Show help if requested or no parameters provided # Show help if requested or no parameters provided
if ($h -or ($o -eq "" -and $s -eq "" -and $d -eq "" -and $t -eq "")) { if ($hp -or ($to -eq "" -and $sr -eq "" -and $dr -eq "" -and $ts -eq "")) {
Show-Help Show-Help
exit 0 exit 0
} }
# Validate that either -s or -d is provided, but not both # Validate that either -sr or -dr is provided, but not both
if ($s -ne "" -and $d -ne "") { if ($sr -ne "" -and $dr -ne "") {
Write-Error "Cannot use both -s and -d options. Use -s for specific files or -d for directories." Write-Error "Cannot use both -sr and -dr options. Use -sr for specific files or -dr for directories."
Write-Host "" Write-Host ""
Show-Help Show-Help
exit 1 exit 1
} }
# Validate required parameters # Validate required parameters
if ($o -eq "" -or ($s -eq "" -and $d -eq "")) { if ($to -eq "" -or ($sr -eq "" -and $dr -eq "")) {
Write-Error "Must provide -o (org) and either -s (specific files) or -d (directory path)." Write-Error "Must provide -to (org) and either -sr (specific files) or -dr (directory path)."
Write-Host "" Write-Host ""
Show-Help Show-Help
exit 1 exit 1
@@ -94,8 +94,8 @@ catch {
$cmd = @("sf", "project", "deploy", "start", "--dry-run") $cmd = @("sf", "project", "deploy", "start", "--dry-run")
# Add source directories (specific files) # Add source directories (specific files)
if ($s -ne "") { if ($sr -ne "") {
$sourcesArray = $s -split "," $sourcesArray = $sr -split ","
foreach ($src in $sourcesArray) { foreach ($src in $sourcesArray) {
$src = $src.Trim() $src = $src.Trim()
if ($src -ne "") { if ($src -ne "") {
@@ -106,20 +106,20 @@ if ($s -ne "") {
} }
# Add directory path # Add directory path
if ($d -ne "") { if ($dr -ne "") {
$cmd += "--source-dir" $cmd += "--source-dir"
$cmd += $d $cmd += $dr
} }
# Add target org # Add target org
if ($o -ne "") { if ($to -ne "") {
$cmd += "--target-org" $cmd += "--target-org"
$cmd += $o $cmd += $to
} }
# Add tests if specified # Add tests if specified
if ($t -ne "") { if ($ts -ne "") {
$testsArray = $t -split "," $testsArray = $ts -split ","
$cmd += "--test-level" $cmd += "--test-level"
$cmd += "RunSpecifiedTests" $cmd += "RunSpecifiedTests"

View File

@@ -1,10 +1,10 @@
param( param(
[string]$n = "", [string]$al = "",
[int]$d = 7, [int]$dd = 7,
[string]$f = "", [string]$df = "",
[switch]$a, [switch]$st,
[string]$t = "", [string]$tp = "",
[switch]$h [switch]$hp
) )
function Show-Help { function Show-Help {
@@ -12,28 +12,28 @@ function Show-Help {
sf-org-create.ps1 wrapper for smart scratch org creation sf-org-create.ps1 wrapper for smart scratch org creation
USAGE: USAGE:
sf-org-create.ps1 -n <ORG_NAME> [-d <DAYS>] [-f <CONFIG_FILE>] [-a] [-t <TEMPLATE>] [-h] sf-org-create.ps1 -al <ORG_NAME> [-dd <DAYS>] [-df <CONFIG_FILE>] [-st] [-tp <TEMPLATE>] [-hp]
OPTIONS: OPTIONS:
-n Name/alias for the new scratch org (required) -al Alias - name/alias for the new scratch org (required)
-d Duration in days (default: 7, max: 30) -dd Duration Days - duration in days (default: 7, max: 30)
-f Path to scratch org definition file (default: config/project-scratch-def.json) -df Definition File - path to scratch org definition file (default: config/project-scratch-def.json)
-a Set as default org alias after creation -st Set Default - set as default org alias after creation
-t Use predefined template (standard, testing, minimal, full) -tp Template - use predefined template (standard, testing, minimal, full)
-h Show this help -hp Help - show this help
EXAMPLES: EXAMPLES:
1) Create basic scratch org: 1) Create basic scratch org:
sf-org-create.ps1 -n "MyDevOrg" sf-org-create.ps1 -al "MyDevOrg"
2) Create testing org for 1 day: 2) Create testing org for 1 day:
sf-org-create.ps1 -n "QuickTest" -d 1 -t testing sf-org-create.ps1 -al "QuickTest" -dd 1 -tp testing
3) Create with custom config and set as default: 3) Create with custom config and set as default:
sf-org-create.ps1 -n "MainDev" -d 14 -f "config/custom-scratch-def.json" -a sf-org-create.ps1 -al "MainDev" -dd 14 -df "config/custom-scratch-def.json" -st
4) Create full-featured org: 4) Create full-featured org:
sf-org-create.ps1 -n "FullEnv" -t full -d 30 sf-org-create.ps1 -al "FullEnv" -tp full -dd 30
TEMPLATES: TEMPLATES:
- standard: Basic scratch org with common features - standard: Basic scratch org with common features
@@ -49,21 +49,21 @@ Notes:
} }
# Show help if requested or no parameters # Show help if requested or no parameters
if ($h -or ($n -eq "" -and $f -eq "" -and $t -eq "")) { if ($hp -or ($al -eq "" -and $df -eq "" -and $tp -eq "")) {
Show-Help Show-Help
exit 0 exit 0
} }
# Validate required parameters # Validate required parameters
if ($n -eq "") { if ($al -eq "") {
Write-Error "Error: Org name (-n) is required." Write-Error "Error: Org alias (-al) is required."
Write-Host "" Write-Host ""
Show-Help Show-Help
exit 1 exit 1
} }
# Validate duration # Validate duration
if ($d -lt 1 -or $d -gt 30) { if ($dd -lt 1 -or $dd -gt 30) {
Write-Error "Error: Duration must be between 1 and 30 days." Write-Error "Error: Duration must be between 1 and 30 days."
exit 1 exit 1
} }
@@ -170,17 +170,17 @@ function New-TemplateConfig {
$finalConfig = "" $finalConfig = ""
$tempConfigCreated = $false $tempConfigCreated = $false
if ($t -ne "") { if ($tp -ne "") {
Write-Host "📝 Creating scratch org definition from template: $t" Write-Host "📝 Creating scratch org definition from template: $tp"
$finalConfig = New-TemplateConfig -Template $t $finalConfig = New-TemplateConfig -Template $tp
$tempConfigCreated = $true $tempConfigCreated = $true
} }
elseif ($f -ne "") { elseif ($df -ne "") {
if (-not (Test-Path $f)) { if (-not (Test-Path $df)) {
Write-Error "Error: Config file '$f' not found." Write-Error "Error: Config file '$df' not found."
exit 1 exit 1
} }
$finalConfig = $f $finalConfig = $df
} }
elseif (Test-Path "config/project-scratch-def.json") { elseif (Test-Path "config/project-scratch-def.json") {
Write-Host "📝 Using default config: config/project-scratch-def.json" Write-Host "📝 Using default config: config/project-scratch-def.json"
@@ -197,16 +197,16 @@ $cmd = @("sf", "org", "create", "scratch")
$cmd += "--definition-file" $cmd += "--definition-file"
$cmd += $finalConfig $cmd += $finalConfig
$cmd += "--duration-days" $cmd += "--duration-days"
$cmd += $d.ToString() $cmd += $dd.ToString()
$cmd += "--alias" $cmd += "--alias"
$cmd += $n $cmd += $al
# Set as default if requested # Set as default if requested
if ($a) { if ($st) {
$cmd += "--set-default" $cmd += "--set-default"
} }
Write-Host "🚀 Creating scratch org '$n' for $d days..." Write-Host "🚀 Creating scratch org '$al' for $dd days..."
Write-Host ">>> Running: $($cmd -join ' ')" -ForegroundColor Yellow Write-Host ">>> Running: $($cmd -join ' ')" -ForegroundColor Yellow
Write-Host "" Write-Host ""
@@ -215,12 +215,12 @@ try {
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
Write-Host "" Write-Host ""
Write-Host "✅ Scratch org '$n' created successfully!" -ForegroundColor Green Write-Host "✅ Scratch org '$al' created successfully!" -ForegroundColor Green
# Open the org # Open the org
Write-Host "🌐 Opening org in browser..." Write-Host "🌐 Opening org in browser..."
try { try {
& sf org open --target-org $n & sf org open --target-org $al
} }
catch { catch {
Write-Host "⚠️ Could not open org in browser" -ForegroundColor Yellow Write-Host "⚠️ Could not open org in browser" -ForegroundColor Yellow
@@ -230,7 +230,7 @@ try {
Write-Host "" Write-Host ""
Write-Host "📊 Org Information:" Write-Host "📊 Org Information:"
try { try {
& sf org display --target-org $n & sf org display --target-org $al
} }
catch { catch {
Write-Host "Could not display org info" Write-Host "Could not display org info"

View File

@@ -1,8 +1,8 @@
param( param(
[string]$o = "", [string]$to = "",
[string]$p = "", [string]$pt = "",
[switch]$U, [switch]$ur,
[switch]$h [switch]$hp
) )
function Show-Help { function Show-Help {
@@ -10,38 +10,38 @@ function Show-Help {
sf-web-open.ps1 PowerShell wrapper for ``sf org open`` sf-web-open.ps1 PowerShell wrapper for ``sf org open``
USAGE: USAGE:
sf-web-open.ps1 [-o <ORG_ALIAS_OR_USERNAME>] [-p <RELATIVE_PATH>] [-U] sf-web-open.ps1 [-to <ORG_ALIAS_OR_USERNAME>] [-pt <RELATIVE_PATH>] [-ur]
sf-web-open.ps1 -h sf-web-open.ps1 -hp
OPTIONS: OPTIONS:
-o Org alias or username to pass as --target-org -to Target org alias or username to pass as --target-org
-p Relative path to open inside the org (e.g., "/lightning/setup/SetupOneHome/home") -pt Path - relative path to open inside the org (e.g., "/lightning/setup/SetupOneHome/home")
-U URL-only: print the URL instead of opening a browser (passes --url-only) -ur URL-only: print the URL instead of opening a browser (passes --url-only)
-h Show this help -hp Help - show this help
EXAMPLES: EXAMPLES:
1) Open a specific org (default home): 1) Open a specific org (default home):
sf-web-open.ps1 -o "DEMO-ORG" sf-web-open.ps1 -to "DEMO-ORG"
2) Open Setup Home of a target org: 2) Open Setup Home of a target org:
sf-web-open.ps1 -o "NUSHUB-DR2" -p "/lightning/setup/SetupOneHome/home" sf-web-open.ps1 -to "NUSHUB-DR2" -pt "/lightning/setup/SetupOneHome/home"
3) Get just the URL for scripting: 3) Get just the URL for scripting:
sf-web-open.ps1 -o "NUSHUB-DR2" -U sf-web-open.ps1 -to "NUSHUB-DR2" -ur
4) Open the current default org (no -o provided): 4) Open the current default org (no -to provided):
sf-web-open.ps1 sf-web-open.ps1
"@ "@
} }
# Show help if requested # Show help if requested
if ($h) { if ($hp) {
Show-Help Show-Help
exit 0 exit 0
} }
# If no parameters provided, show help and examples # If no parameters provided, show help and examples
if ($o -eq "" -and $p -eq "" -and -not $U) { if ($to -eq "" -and $pt -eq "" -and -not $ur) {
Show-Help Show-Help
exit 0 exit 0
} }
@@ -77,19 +77,19 @@ catch {
$cmd = @("sf", "org", "open") $cmd = @("sf", "org", "open")
# Add target org if specified # Add target org if specified
if ($o -ne "") { if ($to -ne "") {
$cmd += "--target-org" $cmd += "--target-org"
$cmd += $o $cmd += $to
} }
# Add path if specified # Add path if specified
if ($p -ne "") { if ($pt -ne "") {
$cmd += "--path" $cmd += "--path"
$cmd += $p $cmd += $pt
} }
# Add URL-only flag if specified # Add URL-only flag if specified
if ($U) { if ($ur) {
$cmd += "--url-only" $cmd += "--url-only"
} }