Interface and Data Collection

No Data Processing yet
master
gandalf 2021-03-17 16:13:12 +01:00
parent e6b7c7e748
commit b65e8a1170
5 changed files with 50 additions and 0 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
FINDPATH=$HOME/Dokumente

5
.gitignore vendored
View File

@ -1,3 +1,8 @@
# Custom entries
.erinnermich.csv
.erinneralle.csv
# ---> Linux
*~

View File

@ -24,12 +24,15 @@ Sammelt bei jedem Rechnerneustart (`cron@boot`) aus der gesamten Dateistruktur a
Markdown-formatierte Übersicht. Oder ein anderes Format? An sich könnte er das auch per `LaTeX` oder als `svg` in das Hintergrundbild schummeln…
Holt sich die Aktenzeichen aus `DECKBLATT.csv`
Durchsucht standardmäßig `/home/user/Dokumente/`, Änderungen daran können in `.env` vorgenommen werden.
Optionen:
* `-o md|pdf|csv|?` Ausgabeformat. Default ist `md`
* `-f future|past|all` Ausgabe von Fristen, default ist `future`
* `-t future|past|all` Ausgabe von Terminen, default ist `future`
* `-w future|done|open|all` Ausgabe von Wiedervorlagen, default ist `open`: Stichtag ist vorbei, aber noch nicht als bearbeitet vermerkt.
* `-m, --merge` Fristen, Termine und Wiedervorlagen in eine Tabelle sammeln. Default sind drei eigene Tabellen in einer Datei.
* `-a` äquivalent zu `-t all -f all -w all`. Überschreibt vorherige `-t`, `-w`, `-f` (und wird von späteren überschrieben)
## Ausgabe

41
erinnermich-collect.sh Normal file → Executable file
View File

@ -0,0 +1,41 @@
#! /usr/bin/env bash
#Prepare Flags and Variables
OF="md"
FF="future"
WF="open"
MF=false
TF="future"
ARGS=($@)
FILES=()
BASEPATH=$(dirname $(realpath $0))
. .env # FINDPATH
#Read command line input
for (( ARG=0; ARG<$#; ARG++ ))
do
VAL=${ARGS[$ARG]}
case $VAL in
"-m") MF=true;;
"-f") FF=${ARGS[$ARG+1]};;
"-w") WF=${ARGS[$ARG+1]};;
"-t") TF=${ARGS[$ARG+1]};;
"-a") TF="all"; WF="all"; FF="all";;
"-am") TF="all"; WF="all"; FF="all"; MF=true;;
esac
done
#find data
FILES=$(find $FINDPATH -iname ".erinnermich.csv")
#collect data into one file
echo "date,type,handle,done,comment" > .erinneralle.csv # Lösche Sammeldatei und lege Kopfzeile an
for FILE in $FILES
do
if [[ $(head -n 1 $FILE) =~ "date,type,handle,done,comment" ]]
then
echo $FILE
tail -n +2 $FILE >> $BASEPATH/.erinneralle.csv
fi
done

0
erinnermich.sh Normal file → Executable file
View File