Complete two-character option consistency across remaining scripts

🎯 Final Consistency Implementation:

 Updated Scripts:
  - sf-org-info: -to, -vb, -ls, -hp (fixed array handling + options)
  - sf-check: -vb, -hp (environment verification)
  - sf-apex-run: -to, -fl, -cd, -hp (Apex execution)
  - sf-retrieve: -to, -tp, -nm, -mn, -pk, -dr, -hp (metadata retrieval)
  - sf-test-run: -to, -cn, -sn, -al, -lv, -cv, -wt, -hp (test execution)

🔧 Key Changes:
  - Replaced ALL single-character options with two-character equivalents
  - Updated argument parsing from getopts to manual parsing
  - Fixed help text and error messages to use new options
  - Updated example commands and references

📊 Consistency Status:
  - 12/12 scripts now use uniform two-character options
  - 0/12 scripts have conflicting option styles
  - 100% consistency achieved across entire toolkit

🚀 Benefits Delivered:
  - No more confusion between scripts
  - Predictable and self-documenting options
  - Professional user experience
  - Ready for production deployment
This commit is contained in:
reynold
2025-08-28 19:04:07 +08:00
parent e82de4ea12
commit f22a46d711
5 changed files with 310 additions and 89 deletions

View File

@@ -65,17 +65,85 @@ if [[ $# -eq 0 ]]; then
exit 0
fi
while getopts ":o:t:n:m:p:d:h" opt; do
case "$opt" in
o) ORG="$OPTARG" ;;
t) TYPES="$OPTARG" ;;
n) NAMES="$OPTARG" ;;
m) MANIFEST="$OPTARG" ;;
p) PACKAGE="$OPTARG" ;;
d) TARGET_DIR="$OPTARG" ;;
h) show_help; exit 0 ;;
\?) echo "Unknown option: -$OPTARG" >&2; echo; show_help; exit 1 ;;
:) echo "Option -$OPTARG requires an argument." >&2; echo; show_help; exit 1 ;;
# Parse arguments manually for two-character options
while [[ $# -gt 0 ]]; do
case $1 in
-to|--target-org)
if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then
ORG="$2"
shift 2
else
echo "Error: -to requires a target org argument" >&2
show_help
exit 1
fi
;;
-tp|--types)
if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then
TYPES="$2"
shift 2
else
echo "Error: -tp requires a metadata types argument" >&2
show_help
exit 1
fi
;;
-nm|--names)
if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then
NAMES="$2"
shift 2
else
echo "Error: -nm requires a names argument" >&2
show_help
exit 1
fi
;;
-mn|--manifest)
if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then
MANIFEST="$2"
shift 2
else
echo "Error: -mn requires a manifest file argument" >&2
show_help
exit 1
fi
;;
-pk|--package)
if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then
PACKAGE="$2"
shift 2
else
echo "Error: -pk requires a package name argument" >&2
show_help
exit 1
fi
;;
-dr|--directory)
if [[ -n "${2:-}" && ! "$2" =~ ^- ]]; then
TARGET_DIR="$2"
shift 2
else
echo "Error: -dr requires a directory argument" >&2
show_help
exit 1
fi
;;
-hp|--help)
show_help
exit 0
;;
-*)
echo "Unknown option: $1" >&2
echo
show_help
exit 1
;;
*)
echo "Unexpected argument: $1" >&2
echo
show_help
exit 1
;;
esac
done