feat: STATUS support

This commit is contained in:
2025-06-16 15:07:58 +02:00
parent 9e2e3bc35b
commit 1093bc15e5
6 changed files with 123 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
## src/awk/parse.awk
## Parse iCalendar file and print its key aspects:
## ```
## <start> <end> <fpath> <collection> <summary>
## <start> <end> <fpath> <collection> <status> <summary>
## ```.
##
## @assign collection_labels: See configuration of the current program.
@@ -72,7 +72,8 @@ function print_data(start, dur, end, summary, cmd, collection, depth, path) {
cmd = "date -d '" end "' +\"%s\""
cmd | getline end
close(cmd)
print start, end, fpath, collection, summary
status = status ? status : "CONFIRMED"
print start, end, fpath, collection, status, summary
}
# AWK program
@@ -89,6 +90,7 @@ BEGIN {
/^DTSTART/ && inside { start = parse() }
/^DTEND/ && inside { end = parse() }
/^DURATION/ && inside { end = parse_duration($NF); dur = 1 }
/^STATUS/ && inside { status = $NF }
/^[^ ]/ && rs { rs = 0 }
/^ / && rs { summary = summary substr($0, 2) }
/^SUMMARY/ && inside { rs = 1; summary = $0 }