From 1ae8df85612280f7a5afb8ba3a56b6cdd30a44fb Mon Sep 17 00:00:00 2001 From: reynold Date: Thu, 28 Aug 2025 22:07:34 +0800 Subject: [PATCH] Enforce strict two-character option scheme across all wrapper scripts - Removed long options from input parsing in all bash scripts - Updated all help texts to show only two-character options - Fixed error messages to reference short options only - All scripts now reject long options like --help, --verbose, --target-org - Maintained internal use of long sf CLI commands (e.g., --target-org passed to sf) - Updated README.md documentation to reflect two-character scheme only - Scripts affected: sf-retrieve, sf-test-run, sf-data-import, sf-data-export - PowerShell scripts already used correct two-character parameter scheme - All wrapper scripts now have consistent user interface This ensures strict consistency in the two-character option scheme while maintaining backward compatibility for the sf CLI commands themselves. --- README.md | 34 +++++++++++++++---------------- sf-apex-run | 8 ++++---- sf-check | 4 ++-- sf-data-export | 4 ++-- sf-data-import | 54 +++++++++++++++++++++++++------------------------- sf-org-create | 24 +++++++++++----------- sf-org-info | 6 +++--- sf-retrieve | 28 +++++++++++++------------- sf-test-run | 16 +++++++-------- 9 files changed, 89 insertions(+), 89 deletions(-) diff --git a/README.md b/README.md index 0593c37..7d23382 100644 --- a/README.md +++ b/README.md @@ -269,7 +269,7 @@ Real-time debug logs tail with filtering, levels, and Apex-only mode. Usage: ```bash -sf-logs-tail [-to ORG] [--user-id USER] [--level DEBUG] [--duration 60] [--filter PATTERN] [--apex-only] +sf-logs-tail [-to ORG] [-ui USER] [-lv DEBUG] [-dr 60] [-ft PATTERN] [-ax] ``` ```powershell sf-logs-tail.ps1 -TargetOrg sandbox -Level DEBUG -Duration 60 -ApexOnly -Filter "MyClass" @@ -285,11 +285,11 @@ sf-deploy -to (-sr ",[,...]" | -dr (-sr ",[,...]" | -dr ] [-pt ] [-ur] ``` **Options:** -- `-to, --target-org` - Org alias or username to pass as --target-org -- `-pt, --path` - Relative path to open inside the org (e.g., "/lightning/setup/SetupOneHome/home") -- `-ur, --url-only` - URL-only: print the URL instead of opening a browser (passes --url-only) -- `-hp, --help` - Show help +- `-to` - Org alias or username to pass as --target-org +- `-pt` - Relative path to open inside the org (e.g., "/lightning/setup/SetupOneHome/home") +- `-ur` - URL-only: print the URL instead of opening a browser (passes --url-only) +- `-hp` - Show help **Examples:** ```bash @@ -377,8 +377,8 @@ sf-check [-ve] [-hp] ``` **Options:** -- `-ve, --verbose` - Verbose output (show detailed information) -- `-hp, --help` - Show help +- `-ve` - Verbose output (show detailed information) +- `-hp` - Show help **Examples:** ```bash diff --git a/sf-apex-run b/sf-apex-run index f7da496..333547c 100755 --- a/sf-apex-run +++ b/sf-apex-run @@ -62,7 +62,7 @@ fi # Parse arguments manually for two-character options while [[ $# -gt 0 ]]; do case $1 in - -to|--target-org) + -to) if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then ORG="$2" shift 2 @@ -72,7 +72,7 @@ while [[ $# -gt 0 ]]; do exit 1 fi ;; - -fl|--file) + -fl) if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then APEX_FILE="$2" shift 2 @@ -82,7 +82,7 @@ while [[ $# -gt 0 ]]; do exit 1 fi ;; - -cd|--code) + -cd) if [[ -n "${2:-}" ]]; then APEX_CODE="$2" shift 2 @@ -92,7 +92,7 @@ while [[ $# -gt 0 ]]; do exit 1 fi ;; - -hp|--help) + -hp) show_help exit 0 ;; diff --git a/sf-check b/sf-check index 8cb2007..4c1d796 100755 --- a/sf-check +++ b/sf-check @@ -210,11 +210,11 @@ VERBOSE=false # Parse arguments manually for two-character options while [[ $# -gt 0 ]]; do case $1 in - -ve|--verbose) + -ve) VERBOSE=true shift ;; - -hp|--help) + -hp) show_help exit 0 ;; diff --git a/sf-data-export b/sf-data-export index 5359443..4af504f 100755 --- a/sf-data-export +++ b/sf-data-export @@ -185,14 +185,14 @@ query_methods=0 [[ -n "$SOBJECT" ]] && ((query_methods++)) if [[ $query_methods -eq 0 ]]; then - echo -e "${RED}Error: Must specify one of: --query, --file, or --sobject${NC}" + echo -e "${RED}Error: Must specify one of: -qy, -fl, or -so${NC}" echo "" echo -e "${YELLOW}Usage examples:${NC}" echo -e "${GRAY} sf-data-export -qy \"SELECT Id, Name FROM Account\"${NC}" echo -e "${GRAY} sf-data-export -fl queries/accounts.soql${NC}" echo -e "${GRAY} sf-data-export -so Account${NC}" echo "" - echo -e "${YELLOW}Use --help for detailed usage information.${NC}" + echo -e "${YELLOW}Use -hp for detailed usage information.${NC}" exit 1 fi diff --git a/sf-data-import b/sf-data-import index fa65441..131c2f4 100755 --- a/sf-data-import +++ b/sf-data-import @@ -20,17 +20,17 @@ show_usage() { echo " sf-data-import [OPTIONS]" echo "" echo "OPTIONS:" - echo " -fl, --file FILE CSV or JSON file to import" - echo " -so, --sobject SOBJECT Target sObject type" - echo " -to, --target-org ORG Target org username or alias" - echo " -op, --operation OP Operation: insert, update, upsert (default: insert)" - echo " -ei, --external-id FIELD External ID field for upsert/update operations" - echo " -bk, --bulk Use bulk API for large datasets" - 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 " -ve, --verbose Enable verbose output" - echo " -hp, --help Show this help message" + echo " -fl CSV or JSON file to import" + echo " -so Target sObject type" + echo " -to Target org username or alias" + echo " -op Operation: insert, update, upsert (default: insert)" + echo " -ei External ID field for upsert/update operations" + echo " -bk Use bulk API for large datasets" + echo " -wt Wait time in minutes (default: 10)" + echo " -bs Batch size for bulk operations (default: 10000)" + echo " -ie Continue on errors (don't fail entire job)" + echo " -ve Enable verbose output" + echo " -hp Show this help message" echo "" echo "EXAMPLES:" echo " sf-data-import -fl accounts.csv -so Account" @@ -171,47 +171,47 @@ VERBOSE=false # Parse command line arguments while [[ $# -gt 0 ]]; do case $1 in - -fl|--file) + -fl) FILE="$2" shift 2 ;; - -so|--sobject) + -so) SOBJECT="$2" shift 2 ;; - -to|--target-org) + -to) TARGET_ORG="$2" shift 2 ;; - -op|--operation) + -op) OPERATION="$2" shift 2 ;; - -ei|--external-id) + -ei) EXTERNAL_ID="$2" shift 2 ;; - -bk|--bulk) + -bk) USE_BULK=true shift ;; - -wt|--wait) + -wt) WAIT_TIME="$2" shift 2 ;; - -bs|--batch-size) + -bs) BATCH_SIZE="$2" shift 2 ;; - -ie|--ignore-errors) + -ie) IGNORE_ERRORS=true shift ;; - -ve|--verbose) + -ve) VERBOSE=true shift ;; - -hp|--help) + -hp) show_usage exit 0 ;; @@ -232,18 +232,18 @@ fi # Validate required parameters if [[ -z "$FILE" ]]; then - echo -e "${RED}Error: Must specify --file parameter${NC}" + echo -e "${RED}Error: Must specify -fl parameter${NC}" echo "" echo -e "${YELLOW}Usage examples:${NC}" - echo -e "${GRAY} sf-data-import --file data.csv --sobject Account${NC}" - echo -e "${GRAY} sf-data-import --file contacts.json --sobject Contact --operation upsert --external-id Email${NC}" + echo -e "${GRAY} sf-data-import -fl data.csv -so Account${NC}" + echo -e "${GRAY} sf-data-import -fl contacts.json -so Contact -op upsert -ei Email${NC}" echo "" - echo -e "${YELLOW}Use --help for detailed usage information.${NC}" + echo -e "${YELLOW}Use -hp for detailed usage information.${NC}" exit 1 fi if [[ -z "$SOBJECT" ]]; then - echo -e "${RED}Error: Must specify --sobject parameter${NC}" + echo -e "${RED}Error: Must specify -so parameter${NC}" exit 1 fi diff --git a/sf-org-create b/sf-org-create index e9eb03d..3e3e540 100755 --- a/sf-org-create +++ b/sf-org-create @@ -9,12 +9,12 @@ USAGE: sf-org-create -al [-dd ] [-df ] [-st] [-tp