- Replace all instances of `TASK_CONFIG_DIR` with `TASK_DOTENV_DIR` across environment-related scripts - Update `init-config-dir` function name to `init-dotenv-dir` for consistency - Adjust documentation and help table entries to reflect the renamed variable and function - Maintain existing functionality and code style throughout affected scripts
31 lines
946 B
Bash
Executable File
31 lines
946 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
list-env() {
|
|
TASK_DOTENV_DIR=${TASK_DOTENV_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_DOTENV_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
|
|
}
|