dot

packages and services management
Log | Files | Refs | README

commit 3286d8f0bcdf1b3c6fc8ba2c973cffda34d4c476
parent b83b25e16ce42bf0680f549ddb108781475d1cb9
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 21 Jan 2018 23:21:25 +0100

agenda with gopher support

Diffstat:
Mbin/agenda | 36+++++++++++++++++++++++++++++-------
Mgit/config | 2+-
2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/bin/agenda b/bin/agenda @@ -1,7 +1,7 @@ #!/bin/sh # plain text agenda reading ical with its own simpler format -AGENDA="${AGENDA:-$HOME/.config/agenda}" +export AGENDA="${AGENDA:-$HOME/.config/agenda}" awk_date=' function leap(yrs) @@ -41,7 +41,7 @@ function to_date(fmt, sec) return sprintf(fmt, yrs, mth, day, hrs, min, sec); }' -awk_import=$awk_date'#OFF=[+-]HH +awk_import=$awk_date' #OFF=[+-]HH function ical_date(str, off) { yrs = substr(str, 1, 4); mth = substr(str, 5, 2); @@ -80,7 +80,7 @@ BEGIN { event["DESCRIPTION"]); }' -awk_sort='#SORT=[BESCL] +awk_sort=' #SORT=[BESCL] BEGIN { FS=":" sort = "sort | cut -f " length(SORT) + 2 "-"; @@ -105,7 +105,7 @@ BEGIN { printf("%s%s\n", prefix, line[i]) | sort; }' -awk_show=$awk_date'#OFF=[+-]HH +awk_show=$awk_date' #OFF=[+-]HH BEGIN { FS = ":"; } @@ -145,7 +145,7 @@ BEGIN { last_day = b_day; }' -awk_to_sec=$awk_date'#DATE=YYYY-MM-DD-HH-MM #OFF=[+-]HH +awk_to_sec=$awk_date' #DATE=YYYY-MM-DD-HH-MM #OFF=[+-]HH BEGIN { yrs = substr(DATE, 1, 4); mth = substr(DATE, 6, 2); @@ -155,6 +155,23 @@ BEGIN { print(to_sec(yrs, mth, day, hrs, min, 0) - OFF * 3600); }' +awk_gopher=$awk_date' +sub("^B:", "") || sub("^E:", "") { + if ($0 > maximum) + maximum = $0; + if ($0 < minimum || minimum == 0) + minimum = $0; +} + +END { + name = FILENAME; + sub(".*/", "", name); + printf("[0|%s - %s - %s|/%s.txt|server|port]\n", + to_date("%d/%02d/%02d", minimum + 3600), + to_date("%d/%02d/%02d", maximum + 3600), name, FILENAME); + +}' + mkdir -p "$AGENDA" case $1 in @@ -172,19 +189,24 @@ case $1 in [ $# -ne 4 ] && exec "$0" off=$(date +%z | cut -c -3) printf 'B:%s\nE:%s\nS:\nC:\nL:\nD:\n:\n' >> "$AGENDA/$2" \ - "$(awk -v DATE="$3" -v OFF="$off" "$awk_to_sec")" \ - "$(awk -v DATE="$4" -v OFF="$off" "$awk_to_sec")" + "$(awk -v DATE="$3" -v OFF="$off" "$awk_to_sec")" \ + "$(awk -v DATE="$4" -v OFF="$off" "$awk_to_sec")" exec "$0" edit "$2" ;; (edit) [ $# -ne 2 ] && exec "$0" exec $EDITOR "$AGENDA/$2" ;; +(gopher) + find "${AGENDA#$PWD/}" -type f ! -name '*.txt' \ + -exec awk "$awk_gopher" {} ';' | sort + ;; (*) echo 'usage: agenda add <name> <YYYY-MM-DD-HH-MM> <YYYY-MM-DD-HH-MM>' echo ' agenda edit <name>' echo ' agenda import <file.ics> <name> [+-]<HH>' echo ' agenda show <name> [BESCL]' + echo ' agenda gopher' echo '' ls -C "$AGENDA" ;; diff --git a/git/config b/git/config @@ -3,7 +3,7 @@ name = Josuah Demangeon [alias] - dog = log --all --graph --date=short --decorate --format='%h %ad %s' + dog = log --all --graph --date=short --branches --decorate --oneline stat = log --graph --decorate --stat poule = pull