Skip to content

Commit 9e0815b

Browse files
author
Taniya Mathur
committed
fix: replace declare -A with POSIX-compatible array syntax for cross-shell compatibility
- Replace associative array with regular array using key:value pairs - Use parameter expansion for splitting pairs - Ensures compatibility with bash, zsh, and other POSIX shells - Fixes 'declare: -A: invalid option' error on macOS/zsh
1 parent 7ec9444 commit 9e0815b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

publish.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,21 @@ check_python_version() {
9090
check_and_install_packages() {
9191
print_info "Checking required Python packages..."
9292

93-
# List of required packages (import_name:package_name)
94-
declare -A required_packages=(
95-
["typer"]="typer"
96-
["rich"]="rich"
97-
["boto3"]="boto3"
98-
["yaml"]="PyYAML"
93+
# List of required packages (import_name:package_name pairs)
94+
required_packages=(
95+
"typer:typer"
96+
"rich:rich"
97+
"boto3:boto3"
98+
"yaml:PyYAML"
9999
)
100100
missing_packages=()
101101

102102
# Check each package
103-
for import_name in "${!required_packages[@]}"; do
103+
for package_pair in "${required_packages[@]}"; do
104+
import_name="${package_pair%%:*}"
105+
package_name="${package_pair##*:}"
104106
if ! $PYTHON_CMD -c "import $import_name" >/dev/null 2>&1; then
105-
missing_packages+=("${required_packages[$import_name]}")
107+
missing_packages+=("$package_name")
106108
fi
107109
done
108110

0 commit comments

Comments
 (0)