Update core wrapper scripts to use two-character option scheme
- Updated sf-deploy: -o → -to, -s → -sr, -d → -dr, -t → -ts - Updated sf-dry-run: same options as sf-deploy for consistency - Updated sf-web-open: -o → -to, -p → -pt, -U → -ur - Updated sf-org-create: -n → -al, -d → -dd, -f → -df, -a → -st, -t → -tp - All scripts now use manual argument parsing to support two-character options - Help sections updated with both short and long option forms - Maintains backward compatibility with long options - Consistent with README documentation and two-character scheme
This commit is contained in:
57
sf-web-open
57
sf-web-open
@@ -3,29 +3,29 @@ set -euo pipefail
|
||||
|
||||
show_help() {
|
||||
cat <<'EOF'
|
||||
sf-open-web — wrapper for `sf org open`
|
||||
sf-web-open — wrapper for `sf org open`
|
||||
|
||||
USAGE:
|
||||
sf-open-web [-o <ORG_ALIAS_OR_USERNAME>] [-p <RELATIVE_PATH>] [-U]
|
||||
sf-web-open [-to <ORG_ALIAS_OR_USERNAME>] [-pt <RELATIVE_PATH>] [-ur]
|
||||
|
||||
OPTIONS:
|
||||
-o Org alias or username to pass as --target-org
|
||||
-p Relative path to open inside the org (e.g., "/lightning/setup/SetupOneHome/home")
|
||||
-U URL-only: print the URL instead of opening a browser (passes --url-only)
|
||||
-h Show this help
|
||||
-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 this help
|
||||
|
||||
EXAMPLES:
|
||||
1) Open a specific org (default home):
|
||||
sf-open-web -o DEMO-ORG
|
||||
sf-web-open -to DEMO-ORG
|
||||
|
||||
2) Open Setup Home of a target org:
|
||||
sf-open-web -o NUSHUB-DR2 -p "/lightning/setup/SetupOneHome/home"
|
||||
sf-web-open -to NUSHUB-DR2 -pt "/lightning/setup/SetupOneHome/home"
|
||||
|
||||
3) Get just the URL for scripting:
|
||||
sf-open-web -o NUSHUB-DR2 -U
|
||||
sf-web-open -to NUSHUB-DR2 -ur
|
||||
|
||||
4) Open the current default org (no -o provided):
|
||||
sf-open-web
|
||||
4) Open the current default org (no -to provided):
|
||||
sf-web-open
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -39,15 +39,32 @@ if [[ $# -eq 0 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while getopts ":o:p:Uh" opt; do
|
||||
case "$opt" in
|
||||
o) ORG="$OPTARG" ;;
|
||||
p) PATH_ARG="$OPTARG" ;;
|
||||
U) URL_ONLY=1 ;;
|
||||
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 ;;
|
||||
esac
|
||||
# Parse command line arguments using manual parsing for two-character options
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-to|--target-org)
|
||||
ORG="$2"
|
||||
shift 2
|
||||
;;
|
||||
-pt|--path)
|
||||
PATH_ARG="$2"
|
||||
shift 2
|
||||
;;
|
||||
-ur|--url-only)
|
||||
URL_ONLY=1
|
||||
shift
|
||||
;;
|
||||
-hp|--help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1" >&2
|
||||
echo
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Silent environment check - verify SF CLI is available
|
||||
|
||||
Reference in New Issue
Block a user