hass.tibber_prices/scripts/help
Julian Pawlowski f60b5990ae test: add pytest framework and midnight-crossing tests
Set up pytest with Home Assistant support and created 6 tests for
midnight-crossing period logic (5 unit tests + 1 integration test).

Added pytest configuration, test dependencies, test runner script
(./scripts/test), and comprehensive tests for group_periods_by_day()
and midnight turnover consistency.

All tests pass in 0.12s.

Impact: Provides regression testing for midnight-crossing period bugs.
Tests validate periods remain visible across midnight turnover.
2025-11-21 23:47:01 +00:00

39 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
# script/help: Display information about available scripts.
set -e
cd "$(dirname "$0")/.."
REPO_NAME=$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || basename "$(pwd)")
printf "\033[1m%s\033[36m %s\033[32m %s\033[0m \n\n" "Development environment for" "$REPO_NAME" ""
echo "Available scripts:"
echo ""
find scripts -type f -perm -111 -print0 | sort -z | while IFS= read -r -d '' script; do
script_name=$(basename "$script")
description=$(awk -v prefix="# script/$script_name:" '
BEGIN {desc=""}
$0 ~ prefix {
line = $0
sub(prefix, "", line)
sub(/^# */, "", line)
desc = desc (desc ? " " : "") line
next
}
desc != "" {exit}
END {print desc}
' "$script")
if [ -z "$description" ]; then
description="No description available"
fi
if [ "${#description}" -gt 60 ]; then
description=$(echo "$description" | cut -c1-57)...
fi
printf " \033[36m %-25s\033[0m %s\n" "scripts/$script_name" "$description"
done
echo ""