dot

packages and services management
Log | Files | Refs | README

commit 8e94e515e18fa9d773f4dcc72346bc8c68c3b63b
parent 40d567038ab4f3b734ead73710f8b40b3f400617
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed, 12 Apr 2017 11:10:22 +0200

renamed commands

Diffstat:
Dbin/calendar-dir | 70----------------------------------------------------------------------
Abin/calendar-import | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mbin/io-run | 1-
Rbin/woman -> bin/man-raw | 0
4 files changed, 65 insertions(+), 71 deletions(-)

diff --git a/bin/calendar-dir b/bin/calendar-dir @@ -1,70 +0,0 @@ -exec awk -v DIR="${2:-.}" ' -# 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 { - path = HOME "" - FS = ":"; -} - - -{ - gsub("\015", ""); - gsub("\t", " "); -} - - -/BEGIN:VEVENT/,/END:VEVENT/ { - if (substr($0, 1, 1) != " ") { - type = $1; - vevent[type] = substr($0, - index($0, ":") + 1, length($0) - length($1)); - } else { - vevent[type] = vevent[type] substr($0, 2, length($0) - 1); - } -} - - -/END:VEVENT/ { - date = vevent["DTSTART"]; - path = DIR "/" \ - substr(date, 1, 4) "-" \ - substr(date, 5, 2) "-" \ - substr(date, 7, 2) "-" \ - substr(date, 10, 2) "-" \ - substr(date, 12, 2); - - date = vevent["DTEND"]; - path = path "--" \ - substr(date, 1, 4) "-" \ - substr(date, 5, 2) "-" \ - substr(date, 7, 2) "-" \ - substr(date, 10, 2) "-" \ - substr(date, 12, 2); - - while (system("test -e *--*--" i) == 0) - i++; - - path = path "--" i; - - gsub(/\\/, "", vevent["SUMMARY"]); - printf("%s\n", vevent["SUMMARY"]) >> path; - - gsub(/\\/, "", vevent["LOCATION"]); - printf("%s\n", vevent["LOCATION"]) >> path; - - gsub(/\\n/, "\n", vevent["DESCRIPTION"]); - gsub(/\\/, "", vevent["DESCRIPTION"]); - print(vevent["DESCRIPTION"]) >> path; -}' "${1:?ical file missing}" diff --git a/bin/calendar-import b/bin/calendar-import @@ -0,0 +1,65 @@ +exec awk -v DIR="${2:-.}" ' +# 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 { + path = HOME "" + FS = ":"; +} + + +{ + gsub("\015", ""); + gsub("\t", " "); +} + + +/BEGIN:VEVENT/,/END:VEVENT/ { + if (substr($0, 1, 1) != " ") { + type = $1; + vevent[type] = substr($0, + index($0, ":") + 1, length($0) - length($1)); + } else { + vevent[type] = vevent[type] substr($0, 2, length($0) - 1); + } +} + + +/END:VEVENT/ { + date = vevent["DTSTART"]; + newdate = DIR "/" \ + substr(date, 1, 4) "/" \ + substr(date, 5, 2) "/" \ + substr(date, 7, 2) " " \ + substr(date, 10, 2) ":" \ + substr(date, 12, 2); + + date = vevent["DTEND"]; + newdate = newdate " " \ + substr(date, 1, 4) "/" \ + substr(date, 5, 2) "/" \ + substr(date, 7, 2) " " \ + substr(date, 10, 2) ":" \ + substr(date, 12, 2); + + while (system("test -e *--*--" i) == 0) + i++; + + gsub(/\\/, "", vevent["SUMMARY"]); + gsub(/\\n/, " ", vevent["DESCRIPTION"]); + gsub(/\\/, "", vevent["DESCRIPTION"]); + printf("%s %s", vevent["SUMMARY"], vevent["DESCRIPTION"]) >> path; + + print(vevent["DESCRIPTION"]) >> path; +}' "${1:?ical file missing}" diff --git a/bin/io-run b/bin/io-run @@ -32,7 +32,6 @@ main() printf '\033[u' 1>&2 [ "$cmd" ] || exit 1 - exec $cmd } diff --git a/bin/woman b/bin/man-raw