dot

packages and services management
Log | Files | Refs | README

commit 7bca81a8729bad87a0ab292683f8e8a89ce22108
parent 3782f95a96300727548cd7a01fb6436806f7a1ba
Author: josuah <mail@josuah.net>
Date:   Tue,  3 Jan 2017 17:33:38 +0100

icaldir: handle same time for calendar

Diffstat:
M.local/bin/icaldir | 29++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/.local/bin/icaldir b/.local/bin/icaldir @@ -1,4 +1,16 @@ -awk -v DIR="$1" '# ical -> one file per event +exec awk -v DIR="${2:-.}" ' +# icaldir - store an ical one file per event + + +# icaldir FILE [DIRECTORY] + + +# name: yyyy-mm-dd-HH-MM--yyyy-mm-dd-HH-MM--<id> +# start time end time incremental id + +# 1: summary +# 2: location +# 3-$: description BEGIN { @@ -41,11 +53,18 @@ BEGIN { substr(date, 10, 2) "-" \ substr(date, 12, 2); - gsub(/\\/, "", vevent["LOCATION"]); - printf("%s\t", vevent["SUMMARY"]) >> path; + while (system("test -e *--*--" i) == 0) + i++; + + path = path "--" i; + + gsub(/\\/, "", vevent["SUMMARY"]); + printf("%s\n", vevent["SUMMARY"]) >> path; gsub(/\\/, "", vevent["LOCATION"]); - printf("%s\t", vevent["LOCATION"]) >> path; + printf("%s\n", vevent["LOCATION"]) >> path; + gsub(/\\n/, "\n", vevent["DESCRIPTION"]); + gsub(/\\/, "", vevent["DESCRIPTION"]); print(vevent["DESCRIPTION"]) >> path; -}' "${2:?Usage: ${0##*/} DIR ICAL}" +}' "${1:?ical file missing}"