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:
@@ -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`
|
||||
|
||||
### Data Operations (100% Updated)
|
||||
- ✅ **sf-data-export**: `-qy`, `-fl`, `-so`, `-to`, `-ot`, `-fm`, `-bk`, `-wt`, `-vb`, `-hp`
|
||||
- ✅ **sf-data-import**: `-fl`, `-so`, `-to`, `-op`, `-ei`, `-bk`, `-wt`, `-bs`, `-ie`, `-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`, `-ve`, `-hp`
|
||||
|
||||
### 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
|
||||
- **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-retrieve**: Help text updated, 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)
|
||||
- **`-to`** → Target Org (replaces `-o`, `--target-org`)
|
||||
- **`-hp`** → Help (replaces `-h`, `--help`)
|
||||
- **`-vb`** → Verbose (replaces `-v`, `--verbose`)
|
||||
- **`-ve`** → Verbose (replaces `-v`, `--verbose`)
|
||||
|
||||
### File & I/O Operations
|
||||
- **`-fl`** → File (replaces `-f`, `--file`)
|
||||
|
||||
14
README.md
14
README.md
@@ -35,7 +35,7 @@ All scripts use an innovative **two-character option scheme** based on syllables
|
||||
### Core Options (consistent across scripts)
|
||||
- `-to, --target-org` - **T**arget **O**rg
|
||||
- `-hp, --help` - **H**el**P**
|
||||
- `-vb, --verbose` - **V**er**B**ose
|
||||
- `-ve, --verbose` - **V**er**B**ose
|
||||
|
||||
### File & I/O Options
|
||||
- `-fl, --file` - **F**i**L**e
|
||||
@@ -156,10 +156,10 @@ Display org information, limits, and list authenticated orgs.
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
sf-org-info -to ORG [--limits] [--list] [-vb]
|
||||
sf-org-info -to ORG [--limits] [--list] [-ve]
|
||||
```
|
||||
```powershell
|
||||
sf-org-info.ps1 -to "myorg" -Limits -vb
|
||||
sf-org-info.ps1 -to "myorg" -Limits -ve
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
@@ -168,7 +168,7 @@ sf-org-info.ps1 -to "myorg" -Limits -vb
|
||||
sf-org-info -to MyOrg
|
||||
|
||||
# Show limits and verbose info
|
||||
sf-org-info -to MyOrg --limits -vb
|
||||
sf-org-info -to MyOrg --limits -ve
|
||||
```
|
||||
|
||||
### sf-retrieve / sf-retrieve.ps1
|
||||
@@ -368,11 +368,11 @@ Environment verification tool that checks if the Salesforce CLI is properly inst
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
sf-check [-vb] [-hp]
|
||||
sf-check [-ve] [-hp]
|
||||
```
|
||||
|
||||
**Options:**
|
||||
- `-vb, --verbose` - Verbose output (show detailed information)
|
||||
- `-ve, --verbose` - Verbose output (show detailed information)
|
||||
- `-hp, --help` - Show help
|
||||
|
||||
**Examples:**
|
||||
@@ -381,7 +381,7 @@ sf-check [-vb] [-hp]
|
||||
sf-check
|
||||
|
||||
# Verbose output with detailed system information
|
||||
sf-check -vb
|
||||
sf-check -ve
|
||||
```
|
||||
|
||||
**What it checks:**
|
||||
|
||||
@@ -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-web-open**: `-to`, `-pt`, `-ur`, `-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-import**: `-fl`, `-so`, `-to`, `-op`, `-ei`, `-bk`, `-wt`, `-bs`, `-ie`, `-vb`, `-hp`
|
||||
- **sf-logs-tail**: `-to`, `-ui`, `-lv`, `-dr`, `-ft`, `-ax`, `-nc`, `-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`, `-ve`, `-hp`
|
||||
- **sf-logs-tail**: `-to`, `-ui`, `-lv`, `-dr`, `-ft`, `-ax`, `-nc`, `-ve`, `-hp`
|
||||
|
||||
### ✅ Working (Accept Two-Character Options)
|
||||
- **sf-check**: Accepts `-hp`, `-vb`
|
||||
- **sf-check**: Accepts `-hp`, `-ve`
|
||||
- **sf-org-info**: Accepts `-to`, `-hp`
|
||||
- **sf-retrieve**: Help updated for two-character options
|
||||
- **sf-test-run**: Accepts `-hp`
|
||||
|
||||
@@ -9,26 +9,26 @@
|
||||
anonymous Apex code from files or inline strings with better formatting
|
||||
and error handling.
|
||||
|
||||
.PARAMETER File
|
||||
.PARAMETER fl
|
||||
Path to Apex file to execute
|
||||
|
||||
.PARAMETER Code
|
||||
Inline Apex code to execute (alternative to -File)
|
||||
.PARAMETER code
|
||||
Inline Apex code to execute (alternative to -fl)
|
||||
|
||||
.PARAMETER o
|
||||
.PARAMETER to
|
||||
Target org username or alias (uses default if not specified)
|
||||
|
||||
.PARAMETER Verbose
|
||||
.PARAMETER ve
|
||||
Enable verbose output showing execution details
|
||||
|
||||
.PARAMETER Help
|
||||
.PARAMETER hp
|
||||
Show this help message
|
||||
|
||||
.EXAMPLE
|
||||
.\sf-apex-run.ps1 -File "scripts/setup.apex"
|
||||
.\sf-apex-run.ps1 -Code "System.debug('Hello World');"
|
||||
.\sf-apex-run.ps1 -File "test.apex" -o "sandbox"
|
||||
.\sf-apex-run.ps1 -Code "Database.insert(new Account(Name='Test'));" -Verbose
|
||||
.\sf-apex-run.ps1 -fl "scripts/setup.apex"
|
||||
.\sf-apex-run.ps1 -code "System.debug('Hello World');"
|
||||
.\sf-apex-run.ps1 -fl "test.apex" -to "sandbox"
|
||||
.\sf-apex-run.ps1 -code "Database.insert(new Account(Name='Test'));" -ve
|
||||
|
||||
.NOTES
|
||||
This script automatically checks for Salesforce CLI installation and runs
|
||||
@@ -37,18 +37,18 @@
|
||||
|
||||
param(
|
||||
[Parameter(ParameterSetName="File")]
|
||||
[string]$File,
|
||||
[string]$fl,
|
||||
|
||||
[Parameter(ParameterSetName="Code")]
|
||||
[string]$Code,
|
||||
[string]$code,
|
||||
|
||||
[string]$o,
|
||||
[switch]$Verbose,
|
||||
[switch]$Help
|
||||
[string]$to,
|
||||
[switch]$ve,
|
||||
[switch]$hp
|
||||
)
|
||||
|
||||
# Show help if requested
|
||||
if ($Help) {
|
||||
if ($hp) {
|
||||
Get-Help $MyInvocation.MyCommand.Path -Detailed
|
||||
exit 0
|
||||
}
|
||||
@@ -110,46 +110,46 @@ if (-not (Test-SalesforceCLI)) {
|
||||
}
|
||||
|
||||
# Validate that either file or code is provided
|
||||
if (-not $File -and -not $Code) {
|
||||
Write-Host "Error: Must specify either -File or -Code parameter" -ForegroundColor Red
|
||||
if (-not $fl -and -not $code) {
|
||||
Write-Host "Error: Must specify either -fl or -code parameter" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
Write-Host "Usage examples:" -ForegroundColor Yellow
|
||||
Write-Host " .\sf-apex-run.ps1 -File `"scripts/setup.apex`"" -ForegroundColor Gray
|
||||
Write-Host " .\sf-apex-run.ps1 -Code `"System.debug('Hello World');`"" -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 ""
|
||||
Write-Host "Use -Help for detailed usage information." -ForegroundColor Yellow
|
||||
Write-Host "Use -hp for detailed usage information." -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Validate that both file and code aren't provided
|
||||
if ($File -and $Code) {
|
||||
Write-Host "Error: Cannot specify both -File and -Code parameters" -ForegroundColor Red
|
||||
if ($fl -and $code) {
|
||||
Write-Host "Error: Cannot specify both -fl and -code parameters" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# If file is specified, validate it exists and read content
|
||||
if ($File) {
|
||||
if (-not (Test-Path $File)) {
|
||||
Write-Host "Error: Apex file not found: $File" -ForegroundColor Red
|
||||
if ($fl) {
|
||||
if (-not (Test-Path $fl)) {
|
||||
Write-Host "Error: Apex file not found: $fl" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
try {
|
||||
$apexContent = Get-Content -Path $File -Raw
|
||||
Write-Host "Using Apex file: $File" -ForegroundColor Green
|
||||
$apexContent = Get-Content -Path $fl -Raw
|
||||
Write-Host "Using Apex file: $fl" -ForegroundColor Green
|
||||
|
||||
if ($Verbose) {
|
||||
Show-CodePreview $apexContent "from file: $File"
|
||||
if ($ve) {
|
||||
Show-CodePreview $apexContent "from file: $fl"
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error reading Apex file: $($_.Exception.Message)" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
$apexContent = $Code
|
||||
$apexContent = $code
|
||||
Write-Host "Using inline Apex code" -ForegroundColor Green
|
||||
|
||||
if ($Verbose) {
|
||||
if ($ve) {
|
||||
Show-CodePreview $apexContent "inline"
|
||||
}
|
||||
}
|
||||
@@ -158,16 +158,14 @@ if ($File) {
|
||||
$sfArgs = @("apex", "run")
|
||||
|
||||
# Add target org if specified
|
||||
if ($o) {
|
||||
if ($to) {
|
||||
$sfArgs += "--target-org"
|
||||
$sfArgs += $o
|
||||
Write-Host "Target org: $o" -ForegroundColor Cyan
|
||||
$sfArgs += $to
|
||||
Write-Host "Target org: $to" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
# Add verbose flag if requested
|
||||
if ($Verbose) {
|
||||
$sfArgs += "--verbose"
|
||||
}
|
||||
# Note: sf apex run doesn't support --verbose flag
|
||||
# Verbose mode only affects our script's output (code preview)
|
||||
|
||||
# Display execution info
|
||||
Write-Host ""
|
||||
@@ -176,7 +174,7 @@ Write-Host "============================" -ForegroundColor Blue
|
||||
|
||||
# Create a temporary file for the Apex content if needed
|
||||
$tempFile = $null
|
||||
if ($Code) {
|
||||
if ($code) {
|
||||
$tempFile = [System.IO.Path]::GetTempFileName() + ".apex"
|
||||
try {
|
||||
Set-Content -Path $tempFile -Value $apexContent -Encoding UTF8
|
||||
@@ -188,7 +186,7 @@ if ($Code) {
|
||||
}
|
||||
} else {
|
||||
$sfArgs += "--file"
|
||||
$sfArgs += $File
|
||||
$sfArgs += $fl
|
||||
}
|
||||
|
||||
# Display the command being run (without showing temp file path)
|
||||
@@ -212,7 +210,7 @@ try {
|
||||
Write-Host ""
|
||||
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
|
||||
}
|
||||
} else {
|
||||
|
||||
10
sf-check
10
sf-check
@@ -13,10 +13,10 @@ show_help() {
|
||||
sf-check — verify Salesforce CLI environment and configuration
|
||||
|
||||
USAGE:
|
||||
sf-check [-vb] [-hp]
|
||||
sf-check [-ve] [-hp]
|
||||
|
||||
OPTIONS:
|
||||
-vb Verbose output (show detailed information)
|
||||
-ve Verbose output (show detailed information)
|
||||
-hp Show this help
|
||||
|
||||
DESCRIPTION:
|
||||
@@ -29,7 +29,7 @@ DESCRIPTION:
|
||||
|
||||
EXAMPLES:
|
||||
sf-check # Basic environment check
|
||||
sf-check -vb # Verbose output with detailed information
|
||||
sf-check -ve # Verbose output with detailed information
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ VERBOSE=false
|
||||
# Parse arguments manually for two-character options
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-vb|--verbose)
|
||||
-ve|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
@@ -273,7 +273,7 @@ main() {
|
||||
|
||||
if [[ "$VERBOSE" != "true" ]]; then
|
||||
echo ""
|
||||
echo "Run 'sf-check -vb' for detailed system information."
|
||||
echo "Run 'sf-check -ve' for detailed system information."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ function Show-Help {
|
||||
sf-check.ps1 — verify Salesforce CLI environment and configuration
|
||||
|
||||
USAGE:
|
||||
sf-check.ps1 [-vb] [-hp]
|
||||
sf-check.ps1 [-ve] [-hp]
|
||||
|
||||
OPTIONS:
|
||||
-vb Verbose output (show detailed information)
|
||||
-ve Verbose output (show detailed information)
|
||||
-hp Help - show this help
|
||||
|
||||
DESCRIPTION:
|
||||
@@ -24,7 +24,7 @@ DESCRIPTION:
|
||||
|
||||
EXAMPLES:
|
||||
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) {
|
||||
Write-Host ""
|
||||
Write-Host "Run 'sf-check.ps1 -vb' for detailed system information."
|
||||
Write-Host "Run 'sf-check.ps1 -ve' for detailed system information."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ show_usage() {
|
||||
echo " -fm Output format: csv, json (default: csv)"
|
||||
echo " -bk Use bulk API for large datasets"
|
||||
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 ""
|
||||
echo "EXAMPLES:"
|
||||
@@ -155,7 +155,7 @@ while [[ $# -gt 0 ]]; do
|
||||
WAIT_TIME="$2"
|
||||
shift 2
|
||||
;;
|
||||
-vb)
|
||||
-ve)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
Wait time in minutes (default: 10) (alias: -wt)
|
||||
|
||||
.PARAMETER Verbose
|
||||
Enable verbose output (alias: -vb)
|
||||
Enable verbose output (alias: -ve)
|
||||
|
||||
.PARAMETER Help
|
||||
Show this help message (alias: -hp)
|
||||
|
||||
@@ -29,7 +29,7 @@ show_usage() {
|
||||
echo " -wt, --wait MINUTES Wait time in minutes (default: 10)"
|
||||
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 " -vb, --verbose Enable verbose output"
|
||||
echo " -ve, --verbose Enable verbose output"
|
||||
echo " -hp, --help Show this help message"
|
||||
echo ""
|
||||
echo "EXAMPLES:"
|
||||
@@ -207,7 +207,7 @@ while [[ $# -gt 0 ]]; do
|
||||
IGNORE_ERRORS=true
|
||||
shift
|
||||
;;
|
||||
-vb|--verbose)
|
||||
-ve|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Continue on errors (don't fail entire job) (alias: -ie)
|
||||
|
||||
.PARAMETER Verbose
|
||||
Enable verbose output (alias: -vb)
|
||||
Enable verbose output (alias: -ve)
|
||||
|
||||
.PARAMETER Help
|
||||
Show this help message (alias: -hp)
|
||||
|
||||
@@ -28,7 +28,7 @@ show_usage() {
|
||||
echo " -ft Filter log entries containing pattern"
|
||||
echo " -ax Show only Apex-related log entries"
|
||||
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 ""
|
||||
echo "EXAMPLES:"
|
||||
@@ -181,7 +181,7 @@ while [[ $# -gt 0 ]]; do
|
||||
NO_COLORS=true
|
||||
shift
|
||||
;;
|
||||
-vb)
|
||||
-ve)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
|
||||
10
sf-org-info
10
sf-org-info
@@ -6,11 +6,11 @@ show_help() {
|
||||
sf-org-info — wrapper for quick org information display
|
||||
|
||||
USAGE:
|
||||
sf-org-info [-to <ORG_ALIAS>] [-vb] [-ls] [-hp]
|
||||
sf-org-info [-to <ORG_ALIAS>] [-ve] [-ls] [-hp]
|
||||
|
||||
OPTIONS:
|
||||
-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
|
||||
-hp Show this help
|
||||
|
||||
@@ -22,7 +22,7 @@ EXAMPLES:
|
||||
sf-org-info -to DEMO-ORG
|
||||
|
||||
3) Show detailed org information:
|
||||
sf-org-info -to DEMO-ORG -vb
|
||||
sf-org-info -to DEMO-ORG -ve
|
||||
|
||||
4) List all authenticated orgs:
|
||||
sf-org-info -ls
|
||||
@@ -61,7 +61,7 @@ while [[ $# -gt 0 ]]; do
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-vb|--verbose)
|
||||
-ve|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
@@ -192,4 +192,4 @@ echo
|
||||
echo "💡 Helpful commands:"
|
||||
echo " - Open this org: sf org open${ORG:+ --target-org \"$ORG\"}"
|
||||
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"
|
||||
|
||||
@@ -9,26 +9,26 @@
|
||||
quick access to org information, limits, and authentication status with
|
||||
clean, formatted output.
|
||||
|
||||
.PARAMETER o
|
||||
.PARAMETER to
|
||||
Target org username or alias (uses default if not specified)
|
||||
|
||||
.PARAMETER Limits
|
||||
.PARAMETER limits
|
||||
Show detailed org limits information
|
||||
|
||||
.PARAMETER ListOrgs
|
||||
.PARAMETER list
|
||||
List all authenticated orgs
|
||||
|
||||
.PARAMETER Verbose
|
||||
.PARAMETER ve
|
||||
Enable verbose output with additional details
|
||||
|
||||
.PARAMETER Help
|
||||
.PARAMETER hp
|
||||
Show this help message
|
||||
|
||||
.EXAMPLE
|
||||
.\sf-org-info.ps1
|
||||
.\sf-org-info.ps1 -o "myorg" -Limits -Verbose
|
||||
.\sf-org-info.ps1 -Limits
|
||||
.\sf-org-info.ps1 -ListOrgs
|
||||
.\sf-org-info.ps1 -to "myorg" -limits -ve
|
||||
.\sf-org-info.ps1 -limits
|
||||
.\sf-org-info.ps1 -list
|
||||
|
||||
.NOTES
|
||||
This script automatically checks for Salesforce CLI installation and runs
|
||||
@@ -36,15 +36,15 @@
|
||||
#>
|
||||
|
||||
param(
|
||||
[string]$o,
|
||||
[switch]$Limits,
|
||||
[switch]$ListOrgs,
|
||||
[switch]$Verbose,
|
||||
[switch]$Help
|
||||
[string]$to,
|
||||
[switch]$limits,
|
||||
[switch]$list,
|
||||
[switch]$ve,
|
||||
[switch]$hp
|
||||
)
|
||||
|
||||
# Show help if requested
|
||||
if ($Help) {
|
||||
if ($hp) {
|
||||
Get-Help $MyInvocation.MyCommand.Path -Detailed
|
||||
exit 0
|
||||
}
|
||||
@@ -86,9 +86,15 @@ function Invoke-SafeSfCommand {
|
||||
Write-Host "Executing: sf $($Arguments -join ' ')" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
& sf @Arguments
|
||||
# Execute the command and capture the output
|
||||
$output = & sf @Arguments 2>&1
|
||||
$exitCode = $LASTEXITCODE
|
||||
|
||||
# Display the output
|
||||
if ($output) {
|
||||
$output | ForEach-Object { Write-Host $_ }
|
||||
}
|
||||
|
||||
if ($exitCode -ne 0) {
|
||||
Write-Host ""
|
||||
Write-Host "❌ Command failed with exit code: $exitCode" -ForegroundColor Red
|
||||
@@ -116,8 +122,8 @@ if (-not (Test-SalesforceCLI)) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# If ListOrgs is specified, show all authenticated orgs and exit
|
||||
if ($ListOrgs) {
|
||||
# If list is specified, show all authenticated orgs and exit
|
||||
if ($list) {
|
||||
Write-SectionHeader "Authenticated Orgs"
|
||||
$success = Invoke-SafeSfCommand @("org", "list")
|
||||
|
||||
@@ -132,14 +138,14 @@ if ($ListOrgs) {
|
||||
$sfArgs = @("org", "display")
|
||||
|
||||
# Add target org if specified
|
||||
if ($o) {
|
||||
if ($to) {
|
||||
$sfArgs += "--target-org"
|
||||
$sfArgs += $o
|
||||
Write-Host "Target org: $o" -ForegroundColor Cyan
|
||||
$sfArgs += $to
|
||||
Write-Host "Target org: $to" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
# Add verbose flag if requested
|
||||
if ($Verbose) {
|
||||
if ($ve) {
|
||||
$sfArgs += "--verbose"
|
||||
}
|
||||
|
||||
@@ -152,15 +158,15 @@ if (-not $success) {
|
||||
}
|
||||
|
||||
# If limits are requested, show org limits
|
||||
if ($Limits) {
|
||||
if ($limits) {
|
||||
Write-SectionHeader "Organization Limits"
|
||||
|
||||
# Build limits command
|
||||
$limitsArgs = @("org", "list", "limits")
|
||||
|
||||
if ($o) {
|
||||
if ($to) {
|
||||
$limitsArgs += "--target-org"
|
||||
$limitsArgs += $o
|
||||
$limitsArgs += $to
|
||||
}
|
||||
|
||||
$success = Invoke-SafeSfCommand $limitsArgs
|
||||
@@ -171,7 +177,7 @@ if ($Limits) {
|
||||
}
|
||||
|
||||
# Show additional org context if verbose
|
||||
if ($Verbose) {
|
||||
if ($ve) {
|
||||
Write-SectionHeader "Additional Context"
|
||||
|
||||
# Show all authenticated orgs for context
|
||||
@@ -186,9 +192,9 @@ if ($Verbose) {
|
||||
Write-Host "👤 Current User Info:" -ForegroundColor Yellow
|
||||
$userArgs = @("org", "display", "user")
|
||||
|
||||
if ($o) {
|
||||
if ($to) {
|
||||
$userArgs += "--target-org"
|
||||
$userArgs += $o
|
||||
$userArgs += $to
|
||||
}
|
||||
|
||||
$success = Invoke-SafeSfCommand $userArgs
|
||||
@@ -198,7 +204,7 @@ if ($Verbose) {
|
||||
Write-Host ""
|
||||
Write-Host "✅ Organization information retrieved successfully!" -ForegroundColor Green
|
||||
|
||||
if (-not $Limits -and -not $Verbose) {
|
||||
if (-not $limits -and -not $ve) {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ echo ""
|
||||
echo -e "${BLUE}=== Testing sf-check ===${NC}"
|
||||
|
||||
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 -e "${BLUE}=== Testing sf-org-info ===${NC}"
|
||||
|
||||
@@ -129,7 +129,7 @@ Write-Blue "=== Testing Core Functionality ===" | Tee-Object -FilePath $LOG_FILE
|
||||
|
||||
# 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
|
||||
Invoke-Test "sf-org-info list" "./sf-org-info -ls" 0 "List authenticated orgs"
|
||||
|
||||
@@ -118,7 +118,7 @@ echo -e "${BLUE}=== Testing Core Functionality ===${NC}" | tee -a "$LOG_FILE"
|
||||
|
||||
# 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
|
||||
run_test "sf-org-info list" "./sf-org-info --list" 0 "List authenticated orgs"
|
||||
|
||||
Reference in New Issue
Block a user