seems to be fertig

Wohooo! Party!
This commit is contained in:
gandalf 2022-06-01 13:37:12 +02:00
parent 313ddd87ba
commit 28db996362
3 changed files with 75 additions and 4 deletions

View file

@ -74,15 +74,15 @@ BASEPATH=$(dirname $(realpath $0))
sed -i "s|replacemedescription|${3//$'\n'/\\\\n}|g" $ics
# what we might need to replace, but not even that often:
# dtstart, time component optional. We only work with minutes here:
[ -n $4 ] && sed -i "s|2300|$4|g" $ics
[ -n "$4" ] && echo ${#4}
[ -n "$4" ] && sed -i "s|2300|$4|g" $ics
# dtend, same as dtstart:
[ -n $5 ] && sed -i "s|2359|$5|g" $ics
[ -n "$5" ] && sed -i "s|2359|$5|g" $ics
# UUID:
sed -i "s|99g999gggg|$UUID|g" $ics
user=$username:$secret
url=$domain/$username/$calendar
# curl -k --user $user -X PUT -H "Content-Type: text/calendar; charset=utf-8" --data-binary @./$ics --url $url/$ics
cat $ics
curl -k --user $user -X PUT -H "Content-Type: text/calendar; charset=utf-8" --data-binary @./$ics --url $url/$ics
fi

View file

@ -0,0 +1,69 @@
#! /bin/bash
# This is a front-end to make the use of add_date.sh more convenient
function usage {
echo "Usage:
$ $0 <category_options> [-d <date>|-P <relativ date>] <description> [-tstart <value>] [-tend <value>]
* <category_options> MUST contain EXACTLY ONE of -frist, -wv or -termin
and can be expanded by e.g. -jura, -personal, ...
Expansion options need to be specified in in your .env first.
* values for -tstart and -tend are military time (HHMM)
* date can be any format that is recognised by the standard tool of the same name.
* EXACTLY ONE of -d and -P is REQUIRED. If both are given, it is not defined which will be passed on.
$ $0 -help
Print this Message and exit"
exit 1
}
#Parsing Parameters:
BASEPATH=$(dirname $(realpath $0))
. $BASEPATH/.env
unset $GETOPT_COMPATIBLE
ARGV=$(getopt -n "$0" -a -o "d:P:" -l "frist,wv,termin,$catopts,help,tstart:,tend:" -- "$@")
if [ $? -ne 0 ]
then
usage
fi
eval set -- "$ARGV"
CATEGORIES=
#Now we have $@ clean and tidy and begin parsing
while :
do
case "$1" in
"--help") usage ;;
"--frist")
CATEGORIES=FRIST,$CATEGORIES
shift ;;
"--termin")
CATEGORIES=TERMIN,$CATEGORIES
shift ;;
"--wv")
CATEGORIES=WV,$CATEGORIES
shift ;;
"--tstart")
tstart=$2
shift ;;
"--tend")
tend=$2
shift ;;
"--"?*)
CATEGORIES=$CATEGORIES$(tr 'a-z' 'A-Z' <<< ${1/--/}),
shift ;;
"-d")
date=$(date -d "$2" +%Y%m%d)
shift
shift ;;
"-P")
date=$(date -d "${${${${2/Y/ years}/m/ months}/W/ weeks}/D/ days}" +%Y%m%d)
shift
shift ;;
"--")
shift
break ;;
esac
done
#letztes Komma aus CATEGORIES streichen
CATEGORIES=${CATEGORIES/%,/}
$BASEPATH/add_date.sh $CATEGORIES $date $1 $tstart $tend;

View file

@ -33,6 +33,8 @@ CATEGORIES:replacemecategory
X-MOZ-GENERATION:1
replacemealarme
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
BEGIN:VTODO
CREATED:20160224T172807Z
LAST-MODIFIED:20160224T172807Z