From 1c7d8418bab65f000e4c142bedad090a0c3a0cd8 Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Tue, 10 Nov 2020 20:01:49 +0100 Subject: [PATCH] [event-participant] Add posibility to add person on same email address --- event-participant | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/event-participant b/event-participant index 497a65f..8bb525a 100755 --- a/event-participant +++ b/event-participant @@ -3,12 +3,15 @@ HELP=" Adds a particpant to an event. - event-participant [--help] [FILE] + event-participant [--help] [+NAME] [FILE] Participant and date added are read from email on standard input. The -record is mantained in FILE. Most common is to leav FILE out, then the +record is mantained in FILE. Most common is to leave FILE out, then the formermost record is reused. +Add extra participants (email taken as From field) with +argument +NAME. + If input is empty, also list of particiants is printed. echo | event-participant @@ -24,6 +27,11 @@ if [[ "$1" == "--help" ]]; then exit 0 fi +if [[ "$1" =~ \+.* ]]; then + extra_name=${1#+} + shift +fi + arg_event="$1" if [ -f "$CACHE" ]; then @@ -55,6 +63,11 @@ else participant="$match" fi [[ "$info" =~ (Date: )([^:]*) ]] + +if [ -n "$extra_name" ]; then + participant="$extra_name $participant" +fi + date=$(date -I -d "${BASH_REMATCH[2]}") echo "${participant},${date}" | -- 2.39.2