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:
72
sf-deploy
72
sf-deploy
@@ -6,32 +6,32 @@ show_help() {
|
|||||||
sf-deploy — wrapper for `sf project deploy start`
|
sf-deploy — wrapper for `sf project deploy start`
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
sf-deploy -o <ORG_ALIAS_OR_USERNAME> (-s "<src1>,<src2>[,...]" | -d <DIRECTORY>) [-t "<Test1>,<Test2>[,...]"]
|
sf-deploy -to <ORG_ALIAS_OR_USERNAME> (-sr "<src1>,<src2>[,...]" | -dr <DIRECTORY>) [-ts "<Test1>,<Test2>[,...]"]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-o Org alias or username for --target-org
|
-to, --target-org Org alias or username for --target-org
|
||||||
-s Comma-separated list of --source-dir paths
|
-sr, --sources Comma-separated list of --source-dir paths
|
||||||
-d Single directory path to deploy (alternative to -s)
|
-dr, --directory Single directory path to deploy (alternative to -sr)
|
||||||
-t Comma-separated list of --tests (enables --test-level RunSpecifiedTests)
|
-ts, --tests Comma-separated list of --tests (enables --test-level RunSpecifiedTests)
|
||||||
-h Show this help
|
-hp, --help Show this help
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
1) Real deploy with multiple flexipages (specific files):
|
1) Real deploy with multiple flexipages (specific files):
|
||||||
sf-deploy -o DEMO-ORG \
|
sf-deploy -to DEMO-ORG \
|
||||||
-s "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Page_Backup_With_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml"
|
-sr "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Page_Backup_With_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml"
|
||||||
|
|
||||||
2) Real deploy with entire directory:
|
2) Real deploy with entire directory:
|
||||||
sf-deploy -o DEMO-ORG -d "force-app/main/default/classes"
|
sf-deploy -to DEMO-ORG -dr "force-app/main/default/classes"
|
||||||
|
|
||||||
3) Real deploy with specified tests:
|
3) Real deploy with specified tests:
|
||||||
sf-deploy -o DEMO-ORG \
|
sf-deploy -to DEMO-ORG \
|
||||||
-s "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" \
|
-sr "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" \
|
||||||
-t "SelectorOpportunity_Test,SelectorOpportunity2_Test"
|
-ts "SelectorOpportunity_Test,SelectorOpportunity2_Test"
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- Use -s for specific files (comma-separated) OR -d for entire directories (not both).
|
- Use -sr for specific files (comma-separated) OR -dr for entire directories (not both).
|
||||||
- Pass absolute or repo-relative paths.
|
- Pass absolute or repo-relative paths.
|
||||||
- Multiple tests are comma-separated in -t; they will be expanded to multiple --tests flags.
|
- Multiple tests are comma-separated in -ts; they will be expanded to multiple --tests flags.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,21 +45,41 @@ if [[ $# -eq 0 ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts ":o:s:d:t:h" opt; do
|
# Parse command line arguments using manual parsing for two-character options
|
||||||
case "$opt" in
|
while [[ $# -gt 0 ]]; do
|
||||||
o) ORG="$OPTARG" ;;
|
case $1 in
|
||||||
s) IFS=',' read -r -a SOURCES_ARR <<< "$OPTARG" ;;
|
-to|--target-org)
|
||||||
d) DIR_PATH="$OPTARG" ;;
|
ORG="$2"
|
||||||
t) IFS=',' read -r -a TESTS_ARR <<< "$OPTARG" ;;
|
shift 2
|
||||||
h) show_help; exit 0 ;;
|
;;
|
||||||
\?) echo "Unknown option: -$OPTARG" >&2; echo; show_help; exit 1 ;;
|
-sr|--sources)
|
||||||
:) echo "Option -$OPTARG requires an argument." >&2; echo; show_help; exit 1 ;;
|
IFS=',' read -r -a SOURCES_ARR <<< "$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-dr|--directory)
|
||||||
|
DIR_PATH="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-ts|--tests)
|
||||||
|
IFS=',' read -r -a TESTS_ARR <<< "$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-hp|--help)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1" >&2
|
||||||
|
echo
|
||||||
|
show_help
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Validate that either -s or -d is provided, but not both
|
# Validate that either -sr or -dr is provided, but not both
|
||||||
if [[ -n "$DIR_PATH" && ${#SOURCES_ARR[@]} -gt 0 ]]; then
|
if [[ -n "$DIR_PATH" && ${#SOURCES_ARR[@]} -gt 0 ]]; then
|
||||||
echo "Error: Cannot use both -s and -d options. Use -s for specific files or -d for directories." >&2
|
echo "Error: Cannot use both -sr and -dr options. Use -sr for specific files or -dr for directories." >&2
|
||||||
echo
|
echo
|
||||||
show_help
|
show_help
|
||||||
exit 1
|
exit 1
|
||||||
@@ -67,7 +87,7 @@ fi
|
|||||||
|
|
||||||
# Validate that at least one source option is provided
|
# Validate that at least one source option is provided
|
||||||
if [[ -z "$DIR_PATH" && ${#SOURCES_ARR[@]} -eq 0 ]]; then
|
if [[ -z "$DIR_PATH" && ${#SOURCES_ARR[@]} -eq 0 ]]; then
|
||||||
echo "Error: Must provide either -s (specific files) or -d (directory path)." >&2
|
echo "Error: Must provide either -sr (specific files) or -dr (directory path)." >&2
|
||||||
echo
|
echo
|
||||||
show_help
|
show_help
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
72
sf-dry-run
72
sf-dry-run
@@ -6,32 +6,32 @@ show_help() {
|
|||||||
sf-dry-run — wrapper for `sf project deploy start --dry-run`
|
sf-dry-run — wrapper for `sf project deploy start --dry-run`
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
sf-dry-run -o <ORG_ALIAS_OR_USERNAME> (-s "<src1>,<src2>[,...]" | -d <DIRECTORY>) [-t "<Test1>,<Test2>[,...]"]
|
sf-dry-run -to <ORG_ALIAS_OR_USERNAME> (-sr "<src1>,<src2>[,...]" | -dr <DIRECTORY>) [-ts "<Test1>,<Test2>[,...]"]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-o Org alias or username for --target-org
|
-to, --target-org Org alias or username for --target-org
|
||||||
-s Comma-separated list of --source-dir paths
|
-sr, --sources Comma-separated list of --source-dir paths
|
||||||
-d Single directory path to validate (alternative to -s)
|
-dr, --directory Single directory path to validate (alternative to -sr)
|
||||||
-t Comma-separated list of --tests (enables --test-level RunSpecifiedTests)
|
-ts, --tests Comma-separated list of --tests (enables --test-level RunSpecifiedTests)
|
||||||
-h Show this help
|
-hp, --help Show this help
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
1) Basic dry-run with multiple flexipages (specific files):
|
1) Basic dry-run with multiple flexipages (specific files):
|
||||||
sf-dry-run -o DEMO-ORG \
|
sf-dry-run -to DEMO-ORG \
|
||||||
-s "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml"
|
-sr "force-app/main/default/flexipages/Sample_Page.flexipage-meta.xml,force-app/main/default/flexipages/Sample_SalesNavigator.flexipage-meta.xml,force-app/main/default/flexipages/Sample_Role_Record_Page.flexipage-meta.xml"
|
||||||
|
|
||||||
2) Dry-run validation for entire directory:
|
2) Dry-run validation for entire directory:
|
||||||
sf-dry-run -o DEMO-ORG -d "force-app/main/default/classes"
|
sf-dry-run -to DEMO-ORG -dr "force-app/main/default/classes"
|
||||||
|
|
||||||
3) Dry-run with specified tests:
|
3) Dry-run with specified tests:
|
||||||
sf-dry-run -o DEMO-ORG \
|
sf-dry-run -to DEMO-ORG \
|
||||||
-s "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" \
|
-sr "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" \
|
||||||
-t "SelectorOpportunity_Test,SelectorOpportunity2_Test"
|
-ts "SelectorOpportunity_Test,SelectorOpportunity2_Test"
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- Use -s for specific files (comma-separated) OR -d for entire directories (not both).
|
- Use -sr for specific files (comma-separated) OR -dr for entire directories (not both).
|
||||||
- Pass absolute or repo-relative paths.
|
- Pass absolute or repo-relative paths.
|
||||||
- Multiple tests are comma-separated in -t; they will be expanded to multiple --tests flags.
|
- Multiple tests are comma-separated in -ts; they will be expanded to multiple --tests flags.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,21 +45,41 @@ if [[ $# -eq 0 ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts ":o:s:d:t:h" opt; do
|
# Parse command line arguments using manual parsing for two-character options
|
||||||
case "$opt" in
|
while [[ $# -gt 0 ]]; do
|
||||||
o) ORG="$OPTARG" ;;
|
case $1 in
|
||||||
s) IFS=',' read -r -a SOURCES_ARR <<< "$OPTARG" ;;
|
-to|--target-org)
|
||||||
d) DIR_PATH="$OPTARG" ;;
|
ORG="$2"
|
||||||
t) IFS=',' read -r -a TESTS_ARR <<< "$OPTARG" ;;
|
shift 2
|
||||||
h) show_help; exit 0 ;;
|
;;
|
||||||
\?) echo "Unknown option: -$OPTARG" >&2; echo; show_help; exit 1 ;;
|
-sr|--sources)
|
||||||
:) echo "Option -$OPTARG requires an argument." >&2; echo; show_help; exit 1 ;;
|
IFS=',' read -r -a SOURCES_ARR <<< "$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-dr|--directory)
|
||||||
|
DIR_PATH="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-ts|--tests)
|
||||||
|
IFS=',' read -r -a TESTS_ARR <<< "$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-hp|--help)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1" >&2
|
||||||
|
echo
|
||||||
|
show_help
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Validate that either -s or -d is provided, but not both
|
# Validate that either -sr or -dr is provided, but not both
|
||||||
if [[ -n "$DIR_PATH" && ${#SOURCES_ARR[@]} -gt 0 ]]; then
|
if [[ -n "$DIR_PATH" && ${#SOURCES_ARR[@]} -gt 0 ]]; then
|
||||||
echo "Error: Cannot use both -s and -d options. Use -s for specific files or -d for directories." >&2
|
echo "Error: Cannot use both -sr and -dr options. Use -sr for specific files or -dr for directories." >&2
|
||||||
echo
|
echo
|
||||||
show_help
|
show_help
|
||||||
exit 1
|
exit 1
|
||||||
@@ -67,7 +87,7 @@ fi
|
|||||||
|
|
||||||
# Validate that at least one source option is provided
|
# Validate that at least one source option is provided
|
||||||
if [[ -z "$DIR_PATH" && ${#SOURCES_ARR[@]} -eq 0 ]]; then
|
if [[ -z "$DIR_PATH" && ${#SOURCES_ARR[@]} -eq 0 ]]; then
|
||||||
echo "Error: Must provide either -s (specific files) or -d (directory path)." >&2
|
echo "Error: Must provide either -sr (specific files) or -dr (directory path)." >&2
|
||||||
echo
|
echo
|
||||||
show_help
|
show_help
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -6,28 +6,28 @@ show_help() {
|
|||||||
sf-org-create — wrapper for smart scratch org creation
|
sf-org-create — wrapper for smart scratch org creation
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
sf-org-create -n <ORG_NAME> [-d <DAYS>] [-f <CONFIG_FILE>] [-a <ALIAS>] [-t <TEMPLATE>] [-h]
|
sf-org-create -al <ORG_NAME> [-dd <DAYS>] [-df <CONFIG_FILE>] [-st] [-tp <TEMPLATE>] [-hp]
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-n Name/alias for the new scratch org (required)
|
-al, --alias Name/alias for the new scratch org (required)
|
||||||
-d Duration in days (default: 7, max: 30)
|
-dd, --duration-days Duration in days (default: 7, max: 30)
|
||||||
-f Path to scratch org definition file (default: config/project-scratch-def.json)
|
-df, --def-file Path to scratch org definition file (default: config/project-scratch-def.json)
|
||||||
-a Set as default org alias after creation
|
-st, --set-default Set as default org alias after creation
|
||||||
-t Use predefined template (standard, testing, minimal, full)
|
-tp, --template Use predefined template (standard, testing, minimal, full)
|
||||||
-h Show this help
|
-hp, --help Show this help
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
1) Create basic scratch org:
|
1) Create basic scratch org:
|
||||||
sf-org-create -n "MyDevOrg"
|
sf-org-create -al "MyDevOrg"
|
||||||
|
|
||||||
2) Create testing org for 1 day:
|
2) Create testing org for 1 day:
|
||||||
sf-org-create -n "QuickTest" -d 1 -t testing
|
sf-org-create -al "QuickTest" -dd 1 -tp testing
|
||||||
|
|
||||||
3) Create with custom config and set as default:
|
3) Create with custom config and set as default:
|
||||||
sf-org-create -n "MainDev" -d 14 -f "config/custom-scratch-def.json" -a
|
sf-org-create -al "MainDev" -dd 14 -df "config/custom-scratch-def.json" -st
|
||||||
|
|
||||||
4) Create full-featured org:
|
4) Create full-featured org:
|
||||||
sf-org-create -n "FullEnv" -t full -d 30
|
sf-org-create -al "FullEnv" -tp full -dd 30
|
||||||
|
|
||||||
TEMPLATES:
|
TEMPLATES:
|
||||||
- standard: Basic scratch org with common features
|
- standard: Basic scratch org with common features
|
||||||
@@ -54,22 +54,45 @@ if [[ $# -eq 0 ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts ":n:d:f:at:h" opt; do
|
# Parse command line arguments using manual parsing for two-character options
|
||||||
case "$opt" in
|
while [[ $# -gt 0 ]]; do
|
||||||
n) ORG_NAME="$OPTARG" ;;
|
case $1 in
|
||||||
d) DURATION="$OPTARG" ;;
|
-al|--alias)
|
||||||
f) CONFIG_FILE="$OPTARG" ;;
|
ORG_NAME="$2"
|
||||||
a) SET_DEFAULT=true ;;
|
shift 2
|
||||||
t) TEMPLATE="$OPTARG" ;;
|
;;
|
||||||
h) show_help; exit 0 ;;
|
-dd|--duration-days)
|
||||||
\?) echo "Unknown option: -$OPTARG" >&2; echo; show_help; exit 1 ;;
|
DURATION="$2"
|
||||||
:) echo "Option -$OPTARG requires an argument." >&2; echo; show_help; exit 1 ;;
|
shift 2
|
||||||
|
;;
|
||||||
|
-df|--def-file)
|
||||||
|
CONFIG_FILE="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-st|--set-default)
|
||||||
|
SET_DEFAULT=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-tp|--template)
|
||||||
|
TEMPLATE="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-hp|--help)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1" >&2
|
||||||
|
echo
|
||||||
|
show_help
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Validate required parameters
|
# Validate required parameters
|
||||||
if [[ -z "$ORG_NAME" ]]; then
|
if [[ -z "$ORG_NAME" ]]; then
|
||||||
echo "Error: Org name (-n) is required." >&2
|
echo "Error: Org alias (-al) is required." >&2
|
||||||
echo
|
echo
|
||||||
show_help
|
show_help
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
55
sf-web-open
55
sf-web-open
@@ -3,29 +3,29 @@ set -euo pipefail
|
|||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
sf-open-web — wrapper for `sf org open`
|
sf-web-open — wrapper for `sf org open`
|
||||||
|
|
||||||
USAGE:
|
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:
|
OPTIONS:
|
||||||
-o Org alias or username to pass as --target-org
|
-to, --target-org Org alias or username to pass as --target-org
|
||||||
-p Relative path to open inside the org (e.g., "/lightning/setup/SetupOneHome/home")
|
-pt, --path 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)
|
-ur, --url-only URL-only: print the URL instead of opening a browser (passes --url-only)
|
||||||
-h Show this help
|
-hp, --help Show this help
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
1) Open a specific org (default home):
|
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:
|
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:
|
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):
|
4) Open the current default org (no -to provided):
|
||||||
sf-open-web
|
sf-web-open
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,14 +39,31 @@ if [[ $# -eq 0 ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts ":o:p:Uh" opt; do
|
# Parse command line arguments using manual parsing for two-character options
|
||||||
case "$opt" in
|
while [[ $# -gt 0 ]]; do
|
||||||
o) ORG="$OPTARG" ;;
|
case $1 in
|
||||||
p) PATH_ARG="$OPTARG" ;;
|
-to|--target-org)
|
||||||
U) URL_ONLY=1 ;;
|
ORG="$2"
|
||||||
h) show_help; exit 0 ;;
|
shift 2
|
||||||
\?) echo "Unknown option: -$OPTARG" >&2; echo; show_help; exit 1 ;;
|
;;
|
||||||
:) echo "Option -$OPTARG requires an argument." >&2; echo; show_help; exit 1 ;;
|
-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
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user