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.
This commit is contained in:
reynold
2025-08-28 22:07:34 +08:00
parent 7aa7a7a688
commit 1ae8df8561
9 changed files with 89 additions and 89 deletions

View File

@@ -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