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

@@ -6,26 +6,26 @@ show_help() {
sf-org-info — wrapper for quick org information display
USAGE:
sf-org-info [-o <ORG_ALIAS>] [-v] [-l] [-h]
sf-org-info [-to <ORG_ALIAS>] [-vb] [-ls] [-hp]
OPTIONS:
-o Org alias or username (if not provided, uses default org)
-v Verbose output (show detailed information)
-l List all authenticated orgs
-h Show this help
-to Target org alias or username (if not provided, uses default org)
-vb Verbose output (show detailed information)
-ls List all authenticated orgs
-hp Show this help
EXAMPLES:
1) Show default org info:
sf-org-info
2) Show specific org info:
sf-org-info -o DEMO-ORG
sf-org-info -to DEMO-ORG
3) Show detailed org information:
sf-org-info -o DEMO-ORG -v
sf-org-info -to DEMO-ORG -vb
4) List all authenticated orgs:
sf-org-info -l
sf-org-info -ls
DISPLAYED INFORMATION:
- Org name and ID
@@ -48,14 +48,43 @@ ORG=""
VERBOSE=false
LIST_ORGS=false
while getopts ":o:vlh" opt; do
case "$opt" in
o) ORG="$OPTARG" ;;
v) VERBOSE=true ;;
l) LIST_ORGS=true ;;
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
;;
-vb|--verbose)
VERBOSE=true
shift
;;
-ls|--list)
LIST_ORGS=true
shift
;;
-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
@@ -162,5 +191,5 @@ echo "✅ Org information displayed successfully!"
echo
echo "💡 Helpful commands:"
echo " - Open this org: sf org open${ORG:+ --target-org \"$ORG\"}"
echo " - List all orgs: sf-org-info -l"
echo " - Detailed info: sf-org-info${ORG:+ -o \"$ORG\"} -v"
echo " - List all orgs: sf-org-info -ls"
echo " - Detailed info: sf-org-info${ORG:+ -to \"$ORG\"} -vb"