Files
git.taskfile.build/bin/list-dotenv
T
Janik von Rotz fa48eda0c0 feat(aliases): implement first-letter shorthand aliases for all bin scripts with collision handling
- Added alias functions to all bin scripts using first-letter pattern (e.g., `av` for `activate-venv`, `cwl` for `commit-with-llm`)
- Implemented collision resolution by extending aliases with additional letters when conflicts occur or when shadowing standard shell commands
- Documented alias implementation approach in library.md with complete alias map for reference
- Verified shell syntax with `bash -n` and ensured proper argument passing with `"$@"`
- Updated prompt frontmatter to reflect completed state and model used (infomaniak/moonshotai/Kimi-K2.6)
2026-07-08 15:42:22 +02:00

72 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
list-dotenv() {
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
# Define column widths
local name_width=30
local type_width=10
local path_width=40 # Adjust as needed
# Print table header
printf "| %-${name_width}s | %-${type_width}s | %-${path_width}s |\n" "Name" "Type" "Path"
echo "|$(printf '%*s' $((name_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((type_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((path_width + 2)) '' | tr ' ' '-')|"
relative-path() {
local target="$1"
local base="$2"
if command -v realpath >/dev/null 2>&1; then
realpath --relative-to="$base" "$target" 2>/dev/null || echo "$target"
else
if [[ "$target" == "$base"/* ]]; then
echo "${target#$base/}"
else
echo "$target"
fi
fi
}
# Process files in TASK_DOTENV_DIR
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 [[ "$env_name" == "template" ]]; then
env_type="template"
elif grep -q "NEXTCLOUD" "$env_file"; then
env_type="nextcloud"
elif grep -q "ODOO_CONTAINER" "$env_file"; then
env_type="upgrade"
fi
local rel_path
rel_path=$(relative-path "$env_file" "$PWD")
printf "| %-${name_width}s | %-${type_width}s | %-${path_width}s |\n" "$env_name" "$env_type" "$rel_path"
fi
done
# Process files in current directory (PWD)
for env_file in .env.*; do
if [[ -f "$env_file" ]]; then
local env_name="${env_file##*/}"
env_name="${env_name#.env.}"
local env_type="project"
if [[ "$env_name" == "template" ]]; then
env_type="template"
fi
local rel_path
rel_path=$(relative-path "$env_file" "$PWD")
printf "| %-${name_width}s | %-${type_width}s | %-${path_width}s |\n" "$env_name" "$env_type" "$rel_path"
fi
done
}
lid() {
list-dotenv "$@"
}