diff --git a/README.md b/README.md index bfca4d8..0593c37 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ All scripts use an innovative **two-character option scheme** based on syllables - `-op, --operation` - **Op**eration - `-wt, --wait` - **W**ai**T** - `-lv, --level` - **L**e**V**el +- `-lm` - **L**i**M**its (show org limits) +- `-ls` - **L**i**S**t (list orgs) ### Benefits - **More Memorable**: `-to` for target-org is intuitive vs cryptic `-o` @@ -156,10 +158,10 @@ Display org information, limits, and list authenticated orgs. **Usage:** ```bash -sf-org-info -to ORG [--limits] [--list] [-ve] +sf-org-info -to ORG [-lm] [-ls] [-ve] ``` ```powershell -sf-org-info.ps1 -to "myorg" -Limits -ve +sf-org-info.ps1 -to "myorg" -lm -ve ``` **Examples:** @@ -168,7 +170,10 @@ sf-org-info.ps1 -to "myorg" -Limits -ve sf-org-info -to MyOrg # Show limits and verbose info -sf-org-info -to MyOrg --limits -ve +sf-org-info -to MyOrg -lm -ve + +# List all authenticated orgs +sf-org-info -ls ``` ### sf-retrieve / sf-retrieve.ps1 diff --git a/sf-org-info b/sf-org-info index 6576da5..aa35f3a 100755 --- a/sf-org-info +++ b/sf-org-info @@ -6,10 +6,11 @@ show_help() { sf-org-info — wrapper for quick org information display USAGE: - sf-org-info [-to ] [-ve] [-ls] [-hp] + sf-org-info [-to ] [-lm] [-ve] [-ls] [-hp] OPTIONS: -to Target org alias or username (if not provided, uses default org) + -lm Show detailed org limits information -ve Verbose output (show detailed information) -ls List all authenticated orgs -hp Show this help @@ -21,10 +22,13 @@ EXAMPLES: 2) Show specific org info: sf-org-info -to DEMO-ORG - 3) Show detailed org information: + 3) Show org limits: + sf-org-info -to DEMO-ORG -lm + + 4) Show detailed org information: sf-org-info -to DEMO-ORG -ve - 4) List all authenticated orgs: + 5) List all authenticated orgs: sf-org-info -ls DISPLAYED INFORMATION: @@ -47,6 +51,13 @@ EOF ORG="" VERBOSE=false LIST_ORGS=false +SHOW_LIMITS=false + +# Show help if no arguments provided (consistent with PowerShell version) +if [[ $# -eq 0 ]]; then + show_help + exit 0 +fi # Parse arguments manually for two-character options while [[ $# -gt 0 ]]; do @@ -61,11 +72,15 @@ while [[ $# -gt 0 ]]; do exit 1 fi ;; + -lm) + SHOW_LIMITS=true + shift + ;; -ve|--verbose) VERBOSE=true shift ;; - -ls|--list) + -ls) LIST_ORGS=true shift ;; @@ -184,6 +199,25 @@ if ! show_org_info "$ORG"; then exit 1 fi +# Show limits if requested +if [[ "$SHOW_LIMITS" == "true" ]]; then + echo + echo "📈 Organization Limits:" + echo "=======================" + + cmd_args=() + if [[ -n "$ORG" ]]; then + cmd_args+=(--target-org "$ORG") + fi + + if sf org list limits ${cmd_args[@]:+"${cmd_args[@]}"} 2>/dev/null; then + echo + else + echo "❌ Unable to retrieve org limits" + echo "Make sure you're authenticated and the org exists." + fi +fi + echo echo "✅ Org information displayed successfully!" @@ -192,4 +226,5 @@ echo echo "💡 Helpful commands:" echo " - Open this org: sf org open${ORG:+ --target-org \"$ORG\"}" echo " - List all orgs: sf-org-info -ls" +echo " - Show limits: sf-org-info${ORG:+ -to \"$ORG\"} -lm" echo " - Detailed info: sf-org-info${ORG:+ -to \"$ORG\"} -ve" diff --git a/sf-org-info.ps1 b/sf-org-info.ps1 index bef2d96..3280fea 100644 --- a/sf-org-info.ps1 +++ b/sf-org-info.ps1 @@ -12,10 +12,10 @@ .PARAMETER to Target org username or alias (uses default if not specified) -.PARAMETER limits +.PARAMETER lm Show detailed org limits information -.PARAMETER list +.PARAMETER ls List all authenticated orgs .PARAMETER ve @@ -26,9 +26,9 @@ .EXAMPLE .\sf-org-info.ps1 - .\sf-org-info.ps1 -to "myorg" -limits -ve - .\sf-org-info.ps1 -limits - .\sf-org-info.ps1 -list + .\sf-org-info.ps1 -to "myorg" -lm -ve + .\sf-org-info.ps1 -lm + .\sf-org-info.ps1 -ls .NOTES This script automatically checks for Salesforce CLI installation and runs @@ -37,14 +37,14 @@ param( [string]$to, - [switch]$limits, - [switch]$list, + [switch]$lm, + [switch]$ls, [switch]$ve, [switch]$hp ) # Show help if requested or if no parameters provided -if ($hp -or (-not $to -and -not $limits -and -not $list -and -not $ve)) { +if ($hp -or (-not $to -and -not $lm -and -not $ls -and -not $ve)) { Get-Help $MyInvocation.MyCommand.Path -Detailed exit 0 } @@ -123,7 +123,7 @@ if (-not (Test-SalesforceCLI)) { } # If list is specified, show all authenticated orgs and exit -if ($list) { +if ($ls) { Write-SectionHeader "Authenticated Orgs" $success = Invoke-SafeSfCommand @("org", "list") @@ -158,7 +158,7 @@ if (-not $success) { } # If limits are requested, show org limits -if ($limits) { +if ($lm) { Write-SectionHeader "Organization Limits" # Build limits command @@ -204,7 +204,7 @@ if ($ve) { Write-Host "" Write-Host "✅ Organization information retrieved successfully!" -ForegroundColor Green -if (-not $limits -and -not $ve) { +if (-not $lm -and -not $ve) { Write-Host "" - Write-Host "💡 Tip: Use -limits to see org limits, -ve for more details, or -list to see all authenticated orgs" -ForegroundColor Yellow + Write-Host "💡 Tip: Use -lm to see org limits, -ve for more details, or -ls to see all authenticated orgs" -ForegroundColor Yellow } diff --git a/test-all-wrappers.sh b/test-all-wrappers.sh index a3eea0b..0fc75a5 100755 --- a/test-all-wrappers.sh +++ b/test-all-wrappers.sh @@ -94,7 +94,7 @@ echo "" echo -e "${BLUE}=== Testing sf-org-info ===${NC}" run_test "sf-org-info target org" "./sf-org-info -to $TEST_ORG" -run_test "sf-org-info list orgs" "./sf-org-info --list" +run_test "sf-org-info list orgs" "./sf-org-info -ls" echo "" echo -e "${BLUE}=== Testing sf-web-open ===${NC}" diff --git a/test-wrapper-suite.sh b/test-wrapper-suite.sh index 29bf510..bf83ff6 100755 --- a/test-wrapper-suite.sh +++ b/test-wrapper-suite.sh @@ -121,7 +121,7 @@ run_test "sf-check basic" "./sf-check" 0 "Basic 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" +run_test "sf-org-info list" "./sf-org-info -ls" 0 "List authenticated orgs" # Create test files for advanced testing echo "FirstName,LastName,Email" > "$TEST_DIR/test-contacts.csv"