improved dayview

This commit is contained in:
Ämin Baumeler 2025-06-05 23:02:35 +02:00
parent e5134fd0a0
commit 19c65d7ce1

28
src/awk/dayview.awk Normal file
View File

@ -0,0 +1,28 @@
function allday() {
return ITALIC FAINT " (allday) " OFF $4
}
function endstoday() {
return CYAN " -- " $2 OFF ": " $4
}
function slice() {
if ($2 == "00:00")
return CYAN $1 " -- " OFF ": " $4
else
return CYAN $1 OFF " -- " CYAN $2 OFF ": " $4
}
BEGIN {
FS = "|";
GREEN = "\033[1;32m";
RED = "\033[1;31m";
WHITE = "\033[1;97m";
CYAN = "\033[1;36m";
ITALIC = "\033[3m";
FAINT = "\033[2m";
OFF = "\033[m";
OFS = "|"
}
/^[0-9]+$/ && hour { print hour, FAINT hour ":00 ----------------------" OFF }
/^[0-9]+$/ { hour = $1 < 10 ? "0"$1 : $1; next }
$1 == hour":00" { print $3, slice(); unset hour; next }
$1 == "00:00" && $2 == "00:00" { print $3, allday(); next }
$1 == "00:00" { print $3, endstoday();next }