Fix functional issues found during comprehensive testing
- Fix sf-retrieve: Replace xargs with Bash parameter expansion for whitespace trimming to avoid 'unterminated quote' errors when processing comma-separated metadata types containing quotes or special characters - Fix sf-apex-run: Replace invalid JavaScript-style ternary operator with proper Bash conditional logic for code truncation display All bash scripts now work correctly with real parameter combinations against live Salesforce orgs. Testing performed against PWC-TEAM-DEV org confirmed all functionality works as documented in README.md
This commit is contained in:
@@ -181,7 +181,11 @@ if [[ -n "$APEX_FILE" ]]; then
|
|||||||
echo " Lines: $(wc -l < "$APEX_FILE")"
|
echo " Lines: $(wc -l < "$APEX_FILE")"
|
||||||
fi
|
fi
|
||||||
elif [[ -n "$APEX_CODE" ]]; then
|
elif [[ -n "$APEX_CODE" ]]; then
|
||||||
echo " Code: ${APEX_CODE:0:50}${#APEX_CODE > 50 ? '...' : ''}"
|
if [[ ${#APEX_CODE} -gt 50 ]]; then
|
||||||
|
echo " Code: ${APEX_CODE:0:50}..."
|
||||||
|
else
|
||||||
|
echo " Code: $APEX_CODE"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
@@ -211,13 +211,17 @@ if [[ -n "$TYPES" ]]; then
|
|||||||
IFS=',' read -ra TYPES_ARR <<< "$TYPES"
|
IFS=',' read -ra TYPES_ARR <<< "$TYPES"
|
||||||
|
|
||||||
for TYPE in "${TYPES_ARR[@]}"; do
|
for TYPE in "${TYPES_ARR[@]}"; do
|
||||||
TYPE=$(echo "$TYPE" | xargs) # Trim whitespace
|
# Trim whitespace using parameter expansion instead of xargs
|
||||||
|
TYPE="${TYPE#"${TYPE%%[![:space:]]*}"}"
|
||||||
|
TYPE="${TYPE%"${TYPE##*[![:space:]]}"}"
|
||||||
if [[ -n "$TYPE" ]]; then
|
if [[ -n "$TYPE" ]]; then
|
||||||
if [[ -n "$NAMES" ]]; then
|
if [[ -n "$NAMES" ]]; then
|
||||||
# If names are specified, add each name for this type
|
# If names are specified, add each name for this type
|
||||||
IFS=',' read -ra NAMES_ARR <<< "$NAMES"
|
IFS=',' read -ra NAMES_ARR <<< "$NAMES"
|
||||||
for NAME in "${NAMES_ARR[@]}"; do
|
for NAME in "${NAMES_ARR[@]}"; do
|
||||||
NAME=$(echo "$NAME" | xargs) # Trim whitespace
|
# Trim whitespace using parameter expansion instead of xargs
|
||||||
|
NAME="${NAME#"${NAME%%[![:space:]]*}"}"
|
||||||
|
NAME="${NAME%"${NAME##*[![:space:]]}"}"
|
||||||
if [[ -n "$NAME" ]]; then
|
if [[ -n "$NAME" ]]; then
|
||||||
CMD+=(--metadata "$TYPE:$NAME")
|
CMD+=(--metadata "$TYPE:$NAME")
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user