diff --git a/sf-deploy b/sf-deploy index 37f4a4d..0ecba9d 100755 --- a/sf-deploy +++ b/sf-deploy @@ -6,32 +6,32 @@ show_help() { sf-deploy — wrapper for `sf project deploy start` USAGE: - sf-deploy -o (-s ",[,...]" | -d ) [-t ",[,...]"] + sf-deploy -to (-sr ",[,...]" | -dr ) [-ts ",[,...]"] OPTIONS: - -o Org alias or username for --target-org - -s Comma-separated list of --source-dir paths - -d Single directory path to deploy (alternative to -s) - -t Comma-separated list of --tests (enables --test-level RunSpecifiedTests) - -h Show this help + -to, --target-org Org alias or username for --target-org + -sr, --sources Comma-separated list of --source-dir paths + -dr, --directory Single directory path to deploy (alternative to -sr) + -ts, --tests Comma-separated list of --tests (enables --test-level RunSpecifiedTests) + -hp, --help Show this help EXAMPLES: 1) Real deploy with multiple flexipages (specific files): - sf-deploy -o 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" + sf-deploy -to DEMO-ORG \ + -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: - 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: - sf-deploy -o 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" \ - -t "SelectorOpportunity_Test,SelectorOpportunity2_Test" + sf-deploy -to DEMO-ORG \ + -sr "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" \ + -ts "SelectorOpportunity_Test,SelectorOpportunity2_Test" 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. -- 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 } @@ -45,21 +45,41 @@ if [[ $# -eq 0 ]]; then exit 0 fi -while getopts ":o:s:d:t:h" opt; do - case "$opt" in - o) ORG="$OPTARG" ;; - s) IFS=',' read -r -a SOURCES_ARR <<< "$OPTARG" ;; - d) DIR_PATH="$OPTARG" ;; - t) IFS=',' read -r -a TESTS_ARR <<< "$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 ;; - 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 + ;; + -sr|--sources) + 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 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 - 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 show_help exit 1 @@ -67,7 +87,7 @@ fi # Validate that at least one source option is provided 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 show_help exit 1 diff --git a/sf-dry-run b/sf-dry-run index 32db72c..515be02 100755 --- a/sf-dry-run +++ b/sf-dry-run @@ -6,32 +6,32 @@ show_help() { sf-dry-run — wrapper for `sf project deploy start --dry-run` USAGE: - sf-dry-run -o (-s ",[,...]" | -d ) [-t ",[,...]"] + sf-dry-run -to (-sr ",[,...]" | -dr ) [-ts ",[,...]"] OPTIONS: - -o Org alias or username for --target-org - -s Comma-separated list of --source-dir paths - -d Single directory path to validate (alternative to -s) - -t Comma-separated list of --tests (enables --test-level RunSpecifiedTests) - -h Show this help + -to, --target-org Org alias or username for --target-org + -sr, --sources Comma-separated list of --source-dir paths + -dr, --directory Single directory path to validate (alternative to -sr) + -ts, --tests Comma-separated list of --tests (enables --test-level RunSpecifiedTests) + -hp, --help Show this help EXAMPLES: 1) Basic dry-run with multiple flexipages (specific files): - sf-dry-run -o 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" + sf-dry-run -to DEMO-ORG \ + -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: - 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: - sf-dry-run -o 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" \ - -t "SelectorOpportunity_Test,SelectorOpportunity2_Test" + sf-dry-run -to DEMO-ORG \ + -sr "force-app/main/default/flexipages/Demo_Page.flexipage-meta.xml,force-app/main/default/flexipages/Demo_Page_Backup_With_SalesNavigator.flexipage-meta.xml" \ + -ts "SelectorOpportunity_Test,SelectorOpportunity2_Test" 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. -- 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 } @@ -45,21 +45,41 @@ if [[ $# -eq 0 ]]; then exit 0 fi -while getopts ":o:s:d:t:h" opt; do - case "$opt" in - o) ORG="$OPTARG" ;; - s) IFS=',' read -r -a SOURCES_ARR <<< "$OPTARG" ;; - d) DIR_PATH="$OPTARG" ;; - t) IFS=',' read -r -a TESTS_ARR <<< "$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 ;; - 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 + ;; + -sr|--sources) + 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 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 - 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 show_help exit 1 @@ -67,7 +87,7 @@ fi # Validate that at least one source option is provided 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 show_help exit 1 diff --git a/sf-org-create b/sf-org-create index 7fe10f5..e9eb03d 100755 --- a/sf-org-create +++ b/sf-org-create @@ -6,28 +6,28 @@ show_help() { sf-org-create — wrapper for smart scratch org creation USAGE: - sf-org-create -n [-d ] [-f ] [-a ] [-t