improvements: presentation
- collection label before time - UTF8 arrow insead of `->`
This commit is contained in:
		@@ -1,26 +1,25 @@
 | 
			
		||||
# 11:00|13:00|1748422800|1748430000|fpath|desc...
 | 
			
		||||
# 00:00|00:00|1748296800|1748383200|fpath|desc...
 | 
			
		||||
function allday(desc) {
 | 
			
		||||
  return ITALIC FAINT "    (allday)    " OFF desc
 | 
			
		||||
# $s|$e|$starttime|$endtime|$fpath|$collection|$description
 | 
			
		||||
function allday(collection, desc) {
 | 
			
		||||
  return collection " " ITALIC FAINT "    (allday)    " OFF desc
 | 
			
		||||
}
 | 
			
		||||
function endstoday(stop, desc) {
 | 
			
		||||
  return CYAN "      -- " stop OFF ": " desc
 | 
			
		||||
function endstoday(stop, collection, desc) {
 | 
			
		||||
  return collection " " CYAN "      -- " stop OFF ": " desc
 | 
			
		||||
}
 | 
			
		||||
function slice(start, stop, desc) {
 | 
			
		||||
function slice(start, stop, collection, desc) {
 | 
			
		||||
  if (stop == "00:00")
 | 
			
		||||
    return CYAN start " --      " OFF ": " desc
 | 
			
		||||
    return collection " " CYAN start " --      " OFF ": " desc
 | 
			
		||||
  else
 | 
			
		||||
    return CYAN start OFF " -- " CYAN stop OFF ": " desc
 | 
			
		||||
    return collection " " CYAN start OFF " -- " CYAN stop OFF ": " desc
 | 
			
		||||
}
 | 
			
		||||
function hrline(hour) {
 | 
			
		||||
  hour = hour < 10 ? "0"hour : hour
 | 
			
		||||
  print today, hour, "", "", "", FAINT hour ":00           ----------------------" OFF
 | 
			
		||||
  print today, hour, "", "", "", "   " FAINT hour ":00           ----------------------" OFF
 | 
			
		||||
}
 | 
			
		||||
function hrlines(start, stop, h,    starth, stoph, tmp, i) {
 | 
			
		||||
  starth = substr(start, 1, 2)
 | 
			
		||||
  stoph = substr(stop, 1, 2)
 | 
			
		||||
  tmp = substr(start, 4, 2) == "00" ? 0 : 1
 | 
			
		||||
  for (i=h; i < starth + tmp; i++)
 | 
			
		||||
  for (i=h; i < starth + tmp && i < dayend; i++)
 | 
			
		||||
    hrline(i)
 | 
			
		||||
  tmp = substr(stop, 4, 2) == "00" ? 0 : 1
 | 
			
		||||
  if (stoph + tmp < daystart)
 | 
			
		||||
@@ -39,11 +38,11 @@ BEGIN {
 | 
			
		||||
  OFF = "\033[m"
 | 
			
		||||
  OFS = "|"
 | 
			
		||||
}
 | 
			
		||||
$1 == "00:00" && $2 == "00:00" { print today, $1, $3, $4, $5, allday($6);        next }
 | 
			
		||||
$1 == "00:00"                  { print today, $1, $3, $4, $5, endstoday($2, $6); next }
 | 
			
		||||
$1 == "00:00" && $2 == "00:00" { print today, $1, $3, $4, $5, allday($6, $7);        next }
 | 
			
		||||
$1 == "00:00"                  { print today, $1, $3, $4, $5, endstoday($2, $6, $7); next }
 | 
			
		||||
$1 ~ /^[0-9]{2}:[0-9]{2}$/     {
 | 
			
		||||
  daystart = hrlines($1, $2, daystart,    starth, stoph, tmp, i)
 | 
			
		||||
  print today, $1, $3, $4, $5, slice($1, $2, $6)
 | 
			
		||||
  print today, $1, $3, $4, $5, slice($1, $2, $6, $7)
 | 
			
		||||
}
 | 
			
		||||
END {
 | 
			
		||||
  hrlines(dayend":00", 0, daystart,    starth, stoph, tmp, i)
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ BEGIN {
 | 
			
		||||
}
 | 
			
		||||
/^[0-7] 00:00 -- 00:00/ { dayline = dayline " " c(); next }
 | 
			
		||||
/^[0-7] 00:00 -- / { dayline = dayline " <--" $4 " " c(); next }
 | 
			
		||||
/^[0-7] [0-9]{2}:[0-9]{2} -- 00:00/ { dayline = dayline " " $2 "--> " c(); next }
 | 
			
		||||
/^[0-7] [0-9]{2}:[0-9]{2} -- 00:00/ { dayline = dayline " " $2 "→" c(); next }
 | 
			
		||||
/^[0-7] [0-9]{2}:[0-9]{2} -- [0-9]{2}:[0-9]{2}/ { dayline = dayline " " $2 " - " $4 " " c(); next }
 | 
			
		||||
/^[0-7]$/ && dayline { print "+", startofweek " +" $0-1 " days", "", dayline; }
 | 
			
		||||
/^[0-7]$/ {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user