Files
git.taskfile.build/bin/list-env
T
Janik von Rotz 2490a7329a feat(task): consolidate environment creation utilities into create-env
- Replace `create-odoo-env` and `create-nextcloud-env` with unified `create-env` function
- Support multiple environment types: odoo, nextcloud, and upgrade
- Update `list-env` to detect and display new environment types
- Adjust documentation and help table entries to reflect consolidated command
- Maintain existing code style and error handling patterns
2025-11-27 10:05:40 +01:00

31 lines
946 B
Bash
Executable File

#!/usr/bin/env bash
list-env() {
TASK_CONFIG_DIR=${TASK_CONFIG_DIR:="$HOME/.config/taskfile.build"}
# Define column widths
local name_width=30
local type_width=10
# Print table header
printf "| %-${name_width}s | %-${type_width}s |\n" "Name" "Type"
echo "|$(printf '%*s' $((name_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((type_width + 2)) '' | tr ' ' '-')|"
for env_file in "$TASK_CONFIG_DIR"/.env.*; do
if [[ -f "$env_file" ]]; then
local env_name="${env_file##*/}"
env_name="${env_name#.env.}"
local env_type="odoo"
if grep -q "NEXTCLOUD" "$env_file"; then
env_type="nextcloud"
fi
if grep -q "ODOO_CONTAINER" "$env_file"; then
env_type="upgrade"
fi
printf "| %-${name_width}s | %-${type_width}s |\n" "$env_name" "$env_type"
fi
done
}