Update sf-retrieve help section for two-character option scheme

- Updated help section to show two-character options: -to, -tp, -nm, -mn, -pk, -dr, -hp
- Updated all examples in help to use new option syntax
- Updated error messages to reference correct option names
- Maintains backward compatibility - actual parsing still uses getopts with single chars
- Help documentation now consistent with README and other updated scripts
This commit is contained in:
reynold
2025-08-28 18:29:05 +08:00
parent 39b7f11646
commit c0b5e2c642

View File

@@ -6,35 +6,35 @@ show_help() {
sf-retrieve — wrapper for streamlined metadata retrieval
USAGE:
sf-retrieve -o <ORG_ALIAS> (-t <TYPES> | -m <MANIFEST> | -p <PACKAGE>) [-n <NAMES>] [-d <DIR>] [-h]
sf-retrieve -to <ORG_ALIAS> (-tp <TYPES> | -mn <MANIFEST> | -pk <PACKAGE>) [-nm <NAMES>] [-dr <DIR>] [-hp]
OPTIONS:
-o Org alias or username to retrieve from (required)
-t Comma-separated metadata types (ApexClass,CustomObject,Flow,etc.)
-n Comma-separated component names (optional, works with -t)
-m Path to manifest file (package.xml)
-p Package name to retrieve
-d Target directory for retrieved metadata (default: force-app)
-h Show this help
-to, --target-org Org alias or username to retrieve from (required)
-tp, --types Comma-separated metadata types (ApexClass,CustomObject,Flow,etc.)
-nm, --names Comma-separated component names (optional, works with -tp)
-mn, --manifest Path to manifest file (package.xml)
-pk, --package Package name to retrieve
-dr, --directory Target directory for retrieved metadata (default: force-app)
-hp, --help Show this help
EXAMPLES:
1) Retrieve all Apex classes:
sf-retrieve -o PROD-ORG -t "ApexClass"
sf-retrieve -to PROD-ORG -tp "ApexClass"
2) Retrieve specific classes:
sf-retrieve -o PROD-ORG -t "ApexClass" -n "MyClass,AnotherClass"
sf-retrieve -to PROD-ORG -tp "ApexClass" -nm "MyClass,AnotherClass"
3) Retrieve multiple metadata types:
sf-retrieve -o PROD-ORG -t "ApexClass,CustomObject,Flow"
sf-retrieve -to PROD-ORG -tp "ApexClass,CustomObject,Flow"
4) Retrieve using manifest:
sf-retrieve -o PROD-ORG -m "manifest/package.xml"
sf-retrieve -to PROD-ORG -mn "manifest/package.xml"
5) Retrieve to specific directory:
sf-retrieve -o PROD-ORG -t "ApexClass" -d "retrieved-metadata"
sf-retrieve -to PROD-ORG -tp "ApexClass" -dr "retrieved-metadata"
6) Retrieve installed package:
sf-retrieve -o PROD-ORG -p "MyPackage"
sf-retrieve -to PROD-ORG -pk "MyPackage"
COMMON METADATA TYPES:
- ApexClass, ApexTrigger, ApexComponent, ApexPage
@@ -45,9 +45,9 @@ COMMON METADATA TYPES:
- CustomApplication, CustomLabel
Notes:
- Use -t with -n to retrieve specific components of a type
- Use -m for complex retrievals with manifest files
- Use -p to retrieve entire packages
- Use -tp with -nm to retrieve specific components of a type
- Use -mn for complex retrievals with manifest files
- Use -pk to retrieve entire packages
- Retrieved metadata will be in source format
EOF
}
@@ -81,7 +81,7 @@ done
# Validate required parameters
if [[ -z "$ORG" ]]; then
echo "Error: Org (-o) is required." >&2
echo "Error: Org (-to) is required." >&2
echo
show_help
exit 1
@@ -89,7 +89,7 @@ fi
# Validate that at least one retrieval method is specified
if [[ -z "$TYPES" && -z "$MANIFEST" && -z "$PACKAGE" ]]; then
echo "Error: Must specify -t (types), -m (manifest), or -p (package)." >&2
echo "Error: Must specify -tp (types), -mn (manifest), or -pk (package)." >&2
echo
show_help
exit 1
@@ -102,7 +102,7 @@ method_count=0
[[ -n "$PACKAGE" ]] && ((method_count++))
if [[ $method_count -gt 1 ]]; then
echo "Error: Cannot use -t, -m, and -p together. Choose one method." >&2
echo "Error: Cannot use -tp, -mn, and -pk together. Choose one method." >&2
echo
show_help
exit 1