-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CTOOLS-373: Added script fix circular reference issue
- Loading branch information
1 parent
03a0e84
commit 99267d5
Showing
3 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
set -eETuo pipefail | ||
|
||
failure() { | ||
local lineno="$1" | ||
local msg="$2" | ||
echo "Failed at $lineno: $msg" | ||
} | ||
trap 'failure ${LINENO} "$BASH_COMMAND"' ERR | ||
|
||
file_path="$1" | ||
import_statement="$2" | ||
update_forward_refs="$3" | ||
|
||
echo "$file_path" | ||
echo "Fixing imports for Access" | ||
|
||
|
||
# Check if the import statement is already present | ||
if ! grep -Fxq "$import_statement" "$file_path"; then | ||
# Append the import statement to the bottom of the file | ||
echo "$import_statement" >> "$file_path" | ||
echo "Import statement added to $file_path" | ||
else | ||
echo "Import statement is already present in $file_path" | ||
fi | ||
|
||
# Append the additional line if it's not already present | ||
if ! grep -Fxq "$update_forward_refs" "$file_path"; then | ||
# Ensure the file ends with a new line, then append the additional line at the bottom | ||
echo -e "\n$update_forward_refs" >> "$file_path" | ||
echo "Import statement added to $file_path" | ||
else | ||
echo "Import statement is already present in $file_path" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters