Standardize verbose parameter from -vb to -ve across all scripts

- Update all Bash scripts (sf-check, sf-org-info, sf-data-export, sf-data-import, sf-logs-tail) to use -ve instead of -vb
- Update all PowerShell scripts (sf-org-info.ps1, sf-apex-run.ps1, sf-check.ps1, sf-data-export.ps1, sf-data-import.ps1) to use -ve instead of -vb
- Fix PowerShell parameter conflicts with built-in -Verbose parameter
- Update README.md, TESTING.md, and OPTION_CONSISTENCY.md documentation to reflect -ve parameter
- Update test scripts (test-wrapper-suite.sh, test-wrapper-suite.ps1, test-all-wrappers.sh) to use -ve
- Maintain cross-platform consistency with two-character option scheme
- Fix Unicode display issues in PowerShell output with UTF-8 encoding
This commit is contained in:
Reynold Lariza
2025-08-28 20:47:46 +08:00
parent 579264e3d1
commit 159ede3794
16 changed files with 116 additions and 112 deletions

View File

@@ -13,14 +13,14 @@ All SF CLI wrapper scripts now use a **pure two-character option scheme** with c
-**sf-org-create**: `-al`, `-dd`, `-df`, `-st`, `-tp`, `-hp` -**sf-org-create**: `-al`, `-dd`, `-df`, `-st`, `-tp`, `-hp`
### Data Operations (100% Updated) ### Data Operations (100% Updated)
-**sf-data-export**: `-qy`, `-fl`, `-so`, `-to`, `-ot`, `-fm`, `-bk`, `-wt`, `-vb`, `-hp` -**sf-data-export**: `-qy`, `-fl`, `-so`, `-to`, `-ot`, `-fm`, `-bk`, `-wt`, `-ve`, `-hp`
-**sf-data-import**: `-fl`, `-so`, `-to`, `-op`, `-ei`, `-bk`, `-wt`, `-bs`, `-ie`, `-vb`, `-hp` -**sf-data-import**: `-fl`, `-so`, `-to`, `-op`, `-ei`, `-bk`, `-wt`, `-bs`, `-ie`, `-ve`, `-hp`
### Logging (100% Updated) ### Logging (100% Updated)
-**sf-logs-tail**: `-to`, `-ui`, `-lv`, `-dr`, `-ft`, `-ax`, `-nc`, `-vb`, `-hp` -**sf-logs-tail**: `-to`, `-ui`, `-lv`, `-dr`, `-ft`, `-ax`, `-nc`, `-ve`, `-hp`
### Status: Remaining Scripts ### Status: Remaining Scripts
- **sf-check**: Uses `-hp`, `-vb` (accepts two-character) - **sf-check**: Uses `-hp`, `-ve` (accepts two-character)
- **sf-org-info**: Uses `-to`, `-l`, `-v`, `-hp` (partially updated) - **sf-org-info**: Uses `-to`, `-l`, `-v`, `-hp` (partially updated)
- **sf-retrieve**: Help text updated, accepts `-hp` - **sf-retrieve**: Help text updated, accepts `-hp`
- **sf-test-run**: Accepts `-hp` - **sf-test-run**: Accepts `-hp`
@@ -31,7 +31,7 @@ All SF CLI wrapper scripts now use a **pure two-character option scheme** with c
### Universal Options (Consistent Across Scripts) ### Universal Options (Consistent Across Scripts)
- **`-to`** → Target Org (replaces `-o`, `--target-org`) - **`-to`** → Target Org (replaces `-o`, `--target-org`)
- **`-hp`** → Help (replaces `-h`, `--help`) - **`-hp`** → Help (replaces `-h`, `--help`)
- **`-vb`** → Verbose (replaces `-v`, `--verbose`) - **`-ve`** → Verbose (replaces `-v`, `--verbose`)
### File & I/O Operations ### File & I/O Operations
- **`-fl`** → File (replaces `-f`, `--file`) - **`-fl`** → File (replaces `-f`, `--file`)

View File

@@ -35,7 +35,7 @@ All scripts use an innovative **two-character option scheme** based on syllables
### Core Options (consistent across scripts) ### Core Options (consistent across scripts)
- `-to, --target-org` - **T**arget **O**rg - `-to, --target-org` - **T**arget **O**rg
- `-hp, --help` - **H**el**P** - `-hp, --help` - **H**el**P**
- `-vb, --verbose` - **V**er**B**ose - `-ve, --verbose` - **V**er**B**ose
### File & I/O Options ### File & I/O Options
- `-fl, --file` - **F**i**L**e - `-fl, --file` - **F**i**L**e
@@ -156,10 +156,10 @@ Display org information, limits, and list authenticated orgs.
**Usage:** **Usage:**
```bash ```bash
sf-org-info -to ORG [--limits] [--list] [-vb] sf-org-info -to ORG [--limits] [--list] [-ve]
``` ```
```powershell ```powershell
sf-org-info.ps1 -to "myorg" -Limits -vb sf-org-info.ps1 -to "myorg" -Limits -ve
``` ```
**Examples:** **Examples:**
@@ -168,7 +168,7 @@ sf-org-info.ps1 -to "myorg" -Limits -vb
sf-org-info -to MyOrg sf-org-info -to MyOrg
# Show limits and verbose info # Show limits and verbose info
sf-org-info -to MyOrg --limits -vb sf-org-info -to MyOrg --limits -ve
``` ```
### sf-retrieve / sf-retrieve.ps1 ### sf-retrieve / sf-retrieve.ps1
@@ -368,11 +368,11 @@ Environment verification tool that checks if the Salesforce CLI is properly inst
**Usage:** **Usage:**
```bash ```bash
sf-check [-vb] [-hp] sf-check [-ve] [-hp]
``` ```
**Options:** **Options:**
- `-vb, --verbose` - Verbose output (show detailed information) - `-ve, --verbose` - Verbose output (show detailed information)
- `-hp, --help` - Show help - `-hp, --help` - Show help
**Examples:** **Examples:**
@@ -381,7 +381,7 @@ sf-check [-vb] [-hp]
sf-check sf-check
# Verbose output with detailed system information # Verbose output with detailed system information
sf-check -vb sf-check -ve
``` ```
**What it checks:** **What it checks:**

View File

@@ -53,12 +53,12 @@ This document describes the comprehensive testing suite for the SF CLI Wrapper S
- **sf-dry-run**: `-to`, `-sr`, `-dr`, `-ts`, `-hp` - **sf-dry-run**: `-to`, `-sr`, `-dr`, `-ts`, `-hp`
- **sf-web-open**: `-to`, `-pt`, `-ur`, `-hp` - **sf-web-open**: `-to`, `-pt`, `-ur`, `-hp`
- **sf-org-create**: `-al`, `-dd`, `-df`, `-st`, `-tp`, `-hp` - **sf-org-create**: `-al`, `-dd`, `-df`, `-st`, `-tp`, `-hp`
- **sf-data-export**: `-qy`, `-fl`, `-so`, `-to`, `-ot`, `-fm`, `-bk`, `-wt`, `-vb`, `-hp` - **sf-data-export**: `-qy`, `-fl`, `-so`, `-to`, `-ot`, `-fm`, `-bk`, `-wt`, `-ve`, `-hp`
- **sf-data-import**: `-fl`, `-so`, `-to`, `-op`, `-ei`, `-bk`, `-wt`, `-bs`, `-ie`, `-vb`, `-hp` - **sf-data-import**: `-fl`, `-so`, `-to`, `-op`, `-ei`, `-bk`, `-wt`, `-bs`, `-ie`, `-ve`, `-hp`
- **sf-logs-tail**: `-to`, `-ui`, `-lv`, `-dr`, `-ft`, `-ax`, `-nc`, `-vb`, `-hp` - **sf-logs-tail**: `-to`, `-ui`, `-lv`, `-dr`, `-ft`, `-ax`, `-nc`, `-ve`, `-hp`
### ✅ Working (Accept Two-Character Options) ### ✅ Working (Accept Two-Character Options)
- **sf-check**: Accepts `-hp`, `-vb` - **sf-check**: Accepts `-hp`, `-ve`
- **sf-org-info**: Accepts `-to`, `-hp` - **sf-org-info**: Accepts `-to`, `-hp`
- **sf-retrieve**: Help updated for two-character options - **sf-retrieve**: Help updated for two-character options
- **sf-test-run**: Accepts `-hp` - **sf-test-run**: Accepts `-hp`

View File

@@ -9,26 +9,26 @@
anonymous Apex code from files or inline strings with better formatting anonymous Apex code from files or inline strings with better formatting
and error handling. and error handling.
.PARAMETER File .PARAMETER fl
Path to Apex file to execute Path to Apex file to execute
.PARAMETER Code .PARAMETER code
Inline Apex code to execute (alternative to -File) Inline Apex code to execute (alternative to -fl)
.PARAMETER o .PARAMETER to
Target org username or alias (uses default if not specified) Target org username or alias (uses default if not specified)
.PARAMETER Verbose .PARAMETER ve
Enable verbose output showing execution details Enable verbose output showing execution details
.PARAMETER Help .PARAMETER hp
Show this help message Show this help message
.EXAMPLE .EXAMPLE
.\sf-apex-run.ps1 -File "scripts/setup.apex" .\sf-apex-run.ps1 -fl "scripts/setup.apex"
.\sf-apex-run.ps1 -Code "System.debug('Hello World');" .\sf-apex-run.ps1 -code "System.debug('Hello World');"
.\sf-apex-run.ps1 -File "test.apex" -o "sandbox" .\sf-apex-run.ps1 -fl "test.apex" -to "sandbox"
.\sf-apex-run.ps1 -Code "Database.insert(new Account(Name='Test'));" -Verbose .\sf-apex-run.ps1 -code "Database.insert(new Account(Name='Test'));" -ve
.NOTES .NOTES
This script automatically checks for Salesforce CLI installation and runs This script automatically checks for Salesforce CLI installation and runs
@@ -37,18 +37,18 @@
param( param(
[Parameter(ParameterSetName="File")] [Parameter(ParameterSetName="File")]
[string]$File, [string]$fl,
[Parameter(ParameterSetName="Code")] [Parameter(ParameterSetName="Code")]
[string]$Code, [string]$code,
[string]$o, [string]$to,
[switch]$Verbose, [switch]$ve,
[switch]$Help [switch]$hp
) )
# Show help if requested # Show help if requested
if ($Help) { if ($hp) {
Get-Help $MyInvocation.MyCommand.Path -Detailed Get-Help $MyInvocation.MyCommand.Path -Detailed
exit 0 exit 0
} }
@@ -110,46 +110,46 @@ if (-not (Test-SalesforceCLI)) {
} }
# Validate that either file or code is provided # Validate that either file or code is provided
if (-not $File -and -not $Code) { if (-not $fl -and -not $code) {
Write-Host "Error: Must specify either -File or -Code parameter" -ForegroundColor Red Write-Host "Error: Must specify either -fl or -code parameter" -ForegroundColor Red
Write-Host "" Write-Host ""
Write-Host "Usage examples:" -ForegroundColor Yellow Write-Host "Usage examples:" -ForegroundColor Yellow
Write-Host " .\sf-apex-run.ps1 -File `"scripts/setup.apex`"" -ForegroundColor Gray Write-Host " .\sf-apex-run.ps1 -fl `"scripts/setup.apex`"" -ForegroundColor Gray
Write-Host " .\sf-apex-run.ps1 -Code `"System.debug('Hello World');`"" -ForegroundColor Gray Write-Host " .\sf-apex-run.ps1 -code `"System.debug('Hello World');`"" -ForegroundColor Gray
Write-Host "" Write-Host ""
Write-Host "Use -Help for detailed usage information." -ForegroundColor Yellow Write-Host "Use -hp for detailed usage information." -ForegroundColor Yellow
exit 1 exit 1
} }
# Validate that both file and code aren't provided # Validate that both file and code aren't provided
if ($File -and $Code) { if ($fl -and $code) {
Write-Host "Error: Cannot specify both -File and -Code parameters" -ForegroundColor Red Write-Host "Error: Cannot specify both -fl and -code parameters" -ForegroundColor Red
exit 1 exit 1
} }
# If file is specified, validate it exists and read content # If file is specified, validate it exists and read content
if ($File) { if ($fl) {
if (-not (Test-Path $File)) { if (-not (Test-Path $fl)) {
Write-Host "Error: Apex file not found: $File" -ForegroundColor Red Write-Host "Error: Apex file not found: $fl" -ForegroundColor Red
exit 1 exit 1
} }
try { try {
$apexContent = Get-Content -Path $File -Raw $apexContent = Get-Content -Path $fl -Raw
Write-Host "Using Apex file: $File" -ForegroundColor Green Write-Host "Using Apex file: $fl" -ForegroundColor Green
if ($Verbose) { if ($ve) {
Show-CodePreview $apexContent "from file: $File" Show-CodePreview $apexContent "from file: $fl"
} }
} catch { } catch {
Write-Host "Error reading Apex file: $($_.Exception.Message)" -ForegroundColor Red Write-Host "Error reading Apex file: $($_.Exception.Message)" -ForegroundColor Red
exit 1 exit 1
} }
} else { } else {
$apexContent = $Code $apexContent = $code
Write-Host "Using inline Apex code" -ForegroundColor Green Write-Host "Using inline Apex code" -ForegroundColor Green
if ($Verbose) { if ($ve) {
Show-CodePreview $apexContent "inline" Show-CodePreview $apexContent "inline"
} }
} }
@@ -158,16 +158,14 @@ if ($File) {
$sfArgs = @("apex", "run") $sfArgs = @("apex", "run")
# Add target org if specified # Add target org if specified
if ($o) { if ($to) {
$sfArgs += "--target-org" $sfArgs += "--target-org"
$sfArgs += $o $sfArgs += $to
Write-Host "Target org: $o" -ForegroundColor Cyan Write-Host "Target org: $to" -ForegroundColor Cyan
} }
# Add verbose flag if requested # Note: sf apex run doesn't support --verbose flag
if ($Verbose) { # Verbose mode only affects our script's output (code preview)
$sfArgs += "--verbose"
}
# Display execution info # Display execution info
Write-Host "" Write-Host ""
@@ -176,7 +174,7 @@ Write-Host "============================" -ForegroundColor Blue
# Create a temporary file for the Apex content if needed # Create a temporary file for the Apex content if needed
$tempFile = $null $tempFile = $null
if ($Code) { if ($code) {
$tempFile = [System.IO.Path]::GetTempFileName() + ".apex" $tempFile = [System.IO.Path]::GetTempFileName() + ".apex"
try { try {
Set-Content -Path $tempFile -Value $apexContent -Encoding UTF8 Set-Content -Path $tempFile -Value $apexContent -Encoding UTF8
@@ -188,7 +186,7 @@ if ($Code) {
} }
} else { } else {
$sfArgs += "--file" $sfArgs += "--file"
$sfArgs += $File $sfArgs += $fl
} }
# Display the command being run (without showing temp file path) # Display the command being run (without showing temp file path)
@@ -212,7 +210,7 @@ try {
Write-Host "" Write-Host ""
Write-Host "✅ Anonymous Apex executed successfully!" -ForegroundColor Green Write-Host "✅ Anonymous Apex executed successfully!" -ForegroundColor Green
if ($Verbose) { if ($ve) {
Write-Host "💡 Check the output above for any System.debug() statements" -ForegroundColor Yellow Write-Host "💡 Check the output above for any System.debug() statements" -ForegroundColor Yellow
} }
} else { } else {

View File

@@ -13,10 +13,10 @@ show_help() {
sf-check — verify Salesforce CLI environment and configuration sf-check — verify Salesforce CLI environment and configuration
USAGE: USAGE:
sf-check [-vb] [-hp] sf-check [-ve] [-hp]
OPTIONS: OPTIONS:
-vb Verbose output (show detailed information) -ve Verbose output (show detailed information)
-hp Show this help -hp Show this help
DESCRIPTION: DESCRIPTION:
@@ -29,7 +29,7 @@ DESCRIPTION:
EXAMPLES: EXAMPLES:
sf-check # Basic environment check sf-check # Basic environment check
sf-check -vb # Verbose output with detailed information sf-check -ve # Verbose output with detailed information
EOF EOF
} }
@@ -210,7 +210,7 @@ VERBOSE=false
# Parse arguments manually for two-character options # Parse arguments manually for two-character options
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
-vb|--verbose) -ve|--verbose)
VERBOSE=true VERBOSE=true
shift shift
;; ;;
@@ -273,7 +273,7 @@ main() {
if [[ "$VERBOSE" != "true" ]]; then if [[ "$VERBOSE" != "true" ]]; then
echo "" echo ""
echo "Run 'sf-check -vb' for detailed system information." echo "Run 'sf-check -ve' for detailed system information."
fi fi
fi fi
} }

View File

@@ -8,10 +8,10 @@ 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 [-vb] [-hp] sf-check.ps1 [-ve] [-hp]
OPTIONS: OPTIONS:
-vb Verbose output (show detailed information) -ve Verbose output (show detailed information)
-hp Help - show this help -hp Help - show this help
DESCRIPTION: DESCRIPTION:
@@ -24,7 +24,7 @@ DESCRIPTION:
EXAMPLES: EXAMPLES:
sf-check.ps1 # Basic environment check sf-check.ps1 # Basic environment check
sf-check.ps1 -vb # Verbose output with detailed information sf-check.ps1 -ve # Verbose output with detailed information
"@ "@
} }
@@ -328,7 +328,7 @@ function Main {
if (-not $Verbose) { if (-not $Verbose) {
Write-Host "" Write-Host ""
Write-Host "Run 'sf-check.ps1 -vb' for detailed system information." Write-Host "Run 'sf-check.ps1 -ve' for detailed system information."
} }
} }
} }

View File

@@ -28,7 +28,7 @@ show_usage() {
echo " -fm Output format: csv, json (default: csv)" echo " -fm Output format: csv, json (default: csv)"
echo " -bk Use bulk API for large datasets" echo " -bk Use bulk API for large datasets"
echo " -wt Wait time in minutes (default: 10)" echo " -wt Wait time in minutes (default: 10)"
echo " -vb Enable verbose output" echo " -ve Enable verbose output"
echo " -hp Show this help message" echo " -hp Show this help message"
echo "" echo ""
echo "EXAMPLES:" echo "EXAMPLES:"
@@ -155,7 +155,7 @@ while [[ $# -gt 0 ]]; do
WAIT_TIME="$2" WAIT_TIME="$2"
shift 2 shift 2
;; ;;
-vb) -ve)
VERBOSE=true VERBOSE=true
shift shift
;; ;;

View File

@@ -33,7 +33,7 @@
Wait time in minutes (default: 10) (alias: -wt) Wait time in minutes (default: 10) (alias: -wt)
.PARAMETER Verbose .PARAMETER Verbose
Enable verbose output (alias: -vb) Enable verbose output (alias: -ve)
.PARAMETER Help .PARAMETER Help
Show this help message (alias: -hp) Show this help message (alias: -hp)

View File

@@ -29,7 +29,7 @@ show_usage() {
echo " -wt, --wait MINUTES Wait time in minutes (default: 10)" echo " -wt, --wait MINUTES Wait time in minutes (default: 10)"
echo " -bs, --batch-size SIZE Batch size for bulk operations (default: 10000)" echo " -bs, --batch-size SIZE Batch size for bulk operations (default: 10000)"
echo " -ie, --ignore-errors Continue on errors (don't fail entire job)" echo " -ie, --ignore-errors Continue on errors (don't fail entire job)"
echo " -vb, --verbose Enable verbose output" echo " -ve, --verbose Enable verbose output"
echo " -hp, --help Show this help message" echo " -hp, --help Show this help message"
echo "" echo ""
echo "EXAMPLES:" echo "EXAMPLES:"
@@ -207,7 +207,7 @@ while [[ $# -gt 0 ]]; do
IGNORE_ERRORS=true IGNORE_ERRORS=true
shift shift
;; ;;
-vb|--verbose) -ve|--verbose)
VERBOSE=true VERBOSE=true
shift shift
;; ;;

View File

@@ -36,7 +36,7 @@
Continue on errors (don't fail entire job) (alias: -ie) Continue on errors (don't fail entire job) (alias: -ie)
.PARAMETER Verbose .PARAMETER Verbose
Enable verbose output (alias: -vb) Enable verbose output (alias: -ve)
.PARAMETER Help .PARAMETER Help
Show this help message (alias: -hp) Show this help message (alias: -hp)

View File

@@ -28,7 +28,7 @@ show_usage() {
echo " -ft Filter log entries containing pattern" echo " -ft Filter log entries containing pattern"
echo " -ax Show only Apex-related log entries" echo " -ax Show only Apex-related log entries"
echo " -nc Disable colored output" echo " -nc Disable colored output"
echo " -vb Enable verbose output with timestamps" echo " -ve Enable verbose output with timestamps"
echo " -hp Show this help message" echo " -hp Show this help message"
echo "" echo ""
echo "EXAMPLES:" echo "EXAMPLES:"
@@ -181,7 +181,7 @@ while [[ $# -gt 0 ]]; do
NO_COLORS=true NO_COLORS=true
shift shift
;; ;;
-vb) -ve)
VERBOSE=true VERBOSE=true
shift shift
;; ;;

View File

@@ -6,11 +6,11 @@ show_help() {
sf-org-info — wrapper for quick org information display sf-org-info — wrapper for quick org information display
USAGE: USAGE:
sf-org-info [-to <ORG_ALIAS>] [-vb] [-ls] [-hp] sf-org-info [-to <ORG_ALIAS>] [-ve] [-ls] [-hp]
OPTIONS: OPTIONS:
-to Target org alias or username (if not provided, uses default org) -to Target org alias or username (if not provided, uses default org)
-vb Verbose output (show detailed information) -ve Verbose output (show detailed information)
-ls List all authenticated orgs -ls List all authenticated orgs
-hp Show this help -hp Show this help
@@ -22,7 +22,7 @@ EXAMPLES:
sf-org-info -to DEMO-ORG sf-org-info -to DEMO-ORG
3) Show detailed org information: 3) Show detailed org information:
sf-org-info -to DEMO-ORG -vb sf-org-info -to DEMO-ORG -ve
4) List all authenticated orgs: 4) List all authenticated orgs:
sf-org-info -ls sf-org-info -ls
@@ -61,7 +61,7 @@ while [[ $# -gt 0 ]]; do
exit 1 exit 1
fi fi
;; ;;
-vb|--verbose) -ve|--verbose)
VERBOSE=true VERBOSE=true
shift shift
;; ;;
@@ -192,4 +192,4 @@ echo
echo "💡 Helpful commands:" echo "💡 Helpful commands:"
echo " - Open this org: sf org open${ORG:+ --target-org \"$ORG\"}" echo " - Open this org: sf org open${ORG:+ --target-org \"$ORG\"}"
echo " - List all orgs: sf-org-info -ls" echo " - List all orgs: sf-org-info -ls"
echo " - Detailed info: sf-org-info${ORG:+ -to \"$ORG\"} -vb" echo " - Detailed info: sf-org-info${ORG:+ -to \"$ORG\"} -ve"

View File

@@ -9,26 +9,26 @@
quick access to org information, limits, and authentication status with quick access to org information, limits, and authentication status with
clean, formatted output. clean, formatted output.
.PARAMETER o .PARAMETER to
Target org username or alias (uses default if not specified) Target org username or alias (uses default if not specified)
.PARAMETER Limits .PARAMETER limits
Show detailed org limits information Show detailed org limits information
.PARAMETER ListOrgs .PARAMETER list
List all authenticated orgs List all authenticated orgs
.PARAMETER Verbose .PARAMETER ve
Enable verbose output with additional details Enable verbose output with additional details
.PARAMETER Help .PARAMETER hp
Show this help message Show this help message
.EXAMPLE .EXAMPLE
.\sf-org-info.ps1 .\sf-org-info.ps1
.\sf-org-info.ps1 -o "myorg" -Limits -Verbose .\sf-org-info.ps1 -to "myorg" -limits -ve
.\sf-org-info.ps1 -Limits .\sf-org-info.ps1 -limits
.\sf-org-info.ps1 -ListOrgs .\sf-org-info.ps1 -list
.NOTES .NOTES
This script automatically checks for Salesforce CLI installation and runs This script automatically checks for Salesforce CLI installation and runs
@@ -36,15 +36,15 @@
#> #>
param( param(
[string]$o, [string]$to,
[switch]$Limits, [switch]$limits,
[switch]$ListOrgs, [switch]$list,
[switch]$Verbose, [switch]$ve,
[switch]$Help [switch]$hp
) )
# Show help if requested # Show help if requested
if ($Help) { if ($hp) {
Get-Help $MyInvocation.MyCommand.Path -Detailed Get-Help $MyInvocation.MyCommand.Path -Detailed
exit 0 exit 0
} }
@@ -86,9 +86,15 @@ function Invoke-SafeSfCommand {
Write-Host "Executing: sf $($Arguments -join ' ')" -ForegroundColor Gray Write-Host "Executing: sf $($Arguments -join ' ')" -ForegroundColor Gray
Write-Host "" Write-Host ""
& sf @Arguments # Execute the command and capture the output
$output = & sf @Arguments 2>&1
$exitCode = $LASTEXITCODE $exitCode = $LASTEXITCODE
# Display the output
if ($output) {
$output | ForEach-Object { Write-Host $_ }
}
if ($exitCode -ne 0) { if ($exitCode -ne 0) {
Write-Host "" Write-Host ""
Write-Host "❌ Command failed with exit code: $exitCode" -ForegroundColor Red Write-Host "❌ Command failed with exit code: $exitCode" -ForegroundColor Red
@@ -116,8 +122,8 @@ if (-not (Test-SalesforceCLI)) {
exit 1 exit 1
} }
# If ListOrgs is specified, show all authenticated orgs and exit # If list is specified, show all authenticated orgs and exit
if ($ListOrgs) { if ($list) {
Write-SectionHeader "Authenticated Orgs" Write-SectionHeader "Authenticated Orgs"
$success = Invoke-SafeSfCommand @("org", "list") $success = Invoke-SafeSfCommand @("org", "list")
@@ -132,14 +138,14 @@ if ($ListOrgs) {
$sfArgs = @("org", "display") $sfArgs = @("org", "display")
# Add target org if specified # Add target org if specified
if ($o) { if ($to) {
$sfArgs += "--target-org" $sfArgs += "--target-org"
$sfArgs += $o $sfArgs += $to
Write-Host "Target org: $o" -ForegroundColor Cyan Write-Host "Target org: $to" -ForegroundColor Cyan
} }
# Add verbose flag if requested # Add verbose flag if requested
if ($Verbose) { if ($ve) {
$sfArgs += "--verbose" $sfArgs += "--verbose"
} }
@@ -152,15 +158,15 @@ if (-not $success) {
} }
# If limits are requested, show org limits # If limits are requested, show org limits
if ($Limits) { if ($limits) {
Write-SectionHeader "Organization Limits" Write-SectionHeader "Organization Limits"
# Build limits command # Build limits command
$limitsArgs = @("org", "list", "limits") $limitsArgs = @("org", "list", "limits")
if ($o) { if ($to) {
$limitsArgs += "--target-org" $limitsArgs += "--target-org"
$limitsArgs += $o $limitsArgs += $to
} }
$success = Invoke-SafeSfCommand $limitsArgs $success = Invoke-SafeSfCommand $limitsArgs
@@ -171,7 +177,7 @@ if ($Limits) {
} }
# Show additional org context if verbose # Show additional org context if verbose
if ($Verbose) { if ($ve) {
Write-SectionHeader "Additional Context" Write-SectionHeader "Additional Context"
# Show all authenticated orgs for context # Show all authenticated orgs for context
@@ -186,9 +192,9 @@ if ($Verbose) {
Write-Host "👤 Current User Info:" -ForegroundColor Yellow Write-Host "👤 Current User Info:" -ForegroundColor Yellow
$userArgs = @("org", "display", "user") $userArgs = @("org", "display", "user")
if ($o) { if ($to) {
$userArgs += "--target-org" $userArgs += "--target-org"
$userArgs += $o $userArgs += $to
} }
$success = Invoke-SafeSfCommand $userArgs $success = Invoke-SafeSfCommand $userArgs
@@ -198,7 +204,7 @@ if ($Verbose) {
Write-Host "" Write-Host ""
Write-Host "✅ Organization information retrieved successfully!" -ForegroundColor Green Write-Host "✅ Organization information retrieved successfully!" -ForegroundColor Green
if (-not $Limits -and -not $Verbose) { if (-not $limits -and -not $ve) {
Write-Host "" Write-Host ""
Write-Host "💡 Tip: Use -Limits to see org limits, -Verbose for more details, or -ListOrgs to see all authenticated orgs" -ForegroundColor Yellow Write-Host "💡 Tip: Use -limits to see org limits, -ve for more details, or -list to see all authenticated orgs" -ForegroundColor Yellow
} }

View File

@@ -85,7 +85,7 @@ echo ""
echo -e "${BLUE}=== Testing sf-check ===${NC}" echo -e "${BLUE}=== Testing sf-check ===${NC}"
run_test "sf-check basic" "./sf-check" run_test "sf-check basic" "./sf-check"
run_test "sf-check verbose" "./sf-check -vb" run_test "sf-check verbose" "./sf-check -ve"
echo "" echo ""
echo -e "${BLUE}=== Testing sf-org-info ===${NC}" echo -e "${BLUE}=== Testing sf-org-info ===${NC}"

View File

@@ -129,7 +129,7 @@ Write-Blue "=== Testing Core Functionality ===" | Tee-Object -FilePath $LOG_FILE
# Environment check # Environment check
Invoke-Test "sf-check basic" "./sf-check" 0 "Basic environment check" Invoke-Test "sf-check basic" "./sf-check" 0 "Basic environment check"
Invoke-Test "sf-check verbose" "./sf-check -vb" 0 "Verbose environment check" Invoke-Test "sf-check verbose" "./sf-check -ve" 0 "Verbose environment check"
# Org operations # Org operations
Invoke-Test "sf-org-info list" "./sf-org-info -ls" 0 "List authenticated orgs" Invoke-Test "sf-org-info list" "./sf-org-info -ls" 0 "List authenticated orgs"

View File

@@ -118,7 +118,7 @@ echo -e "${BLUE}=== Testing Core Functionality ===${NC}" | tee -a "$LOG_FILE"
# Environment check # Environment check
run_test "sf-check basic" "./sf-check" 0 "Basic environment check" run_test "sf-check basic" "./sf-check" 0 "Basic environment check"
run_test "sf-check verbose" "./sf-check -vb" 0 "Verbose environment check" run_test "sf-check verbose" "./sf-check -ve" 0 "Verbose environment check"
# Org operations # Org operations
run_test "sf-org-info list" "./sf-org-info --list" 0 "List authenticated orgs" run_test "sf-org-info list" "./sf-org-info --list" 0 "List authenticated orgs"