-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_mtg.sh
More file actions
executable file
·128 lines (93 loc) · 2.66 KB
/
create_mtg.sh
File metadata and controls
executable file
·128 lines (93 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#
# Time-stamp: <Friday 2024-10-07 11:22:02 Jess Moore>
#
# Creates a markdown meeting file
#
# Usage: bash create_mtg.sh 20230407-notes.md "Mtg with xyz" "Jane, Bob, Liz, Sam" "ANU"
# shellcheck disable=SC2012
SOURCE=$(ls -l "$(which "$0")" | awk '{print $11}')
function usage() {
echo "Usage: $(basename "$0") 'title' 'attendee1, attendee2' 'place'"
echo ""
echo "Description: This script creates a markdown file for"
echo " meeting notes prepopulated with fields: title, "
echo " date, author, location, and headings for actions, "
echo " talking points, and discussion."
echo ""
echo "Arguments:"
echo " title: Meeting title in quotes."
echo " attendees: Comma separated attendees surrounded "
echo " in quotes."
echo " place: Meeting location in quotes, e.g. Teams."
echo ""
echo "Source: $SOURCE"
echo ""
exit 1 # Exit with a non-zero status to indicate an error
}
if [[ $# -eq 0 || $* == *"help"* || $* == *"-h"* ]]; then
usage
fi
AUTHOR=$(id -F)
NOW=$(date "+%A %Y-%m-%d %H:%M:%S")
TITLE=$1
ATTENDEES=$2
PLACE=$3
## Form filename with syntax YYmmdd-person1_person2_author.md
# Convert attendees to lc, replace ' ' with '_'
PEOPLE_SUMM=$(echo "$ATTENDEES" | awk '{print tolower($0);}' | sed 's/ /_/g')
# Read into array
delimiter=","
# Store the original IFS to restore it later
OIFS=$IFS
# Set IFS to the desired delimiter
IFS="$delimiter"
read -ra PEOPLE <<< "$PEOPLE_SUMM"
# Restore original delimiter
IFS=$OIFS
# replace ", " with "_"
# PEOPLE_SUMM=$(echo "$PEOPLE_SUMM" | sed 's/,/ /g;s/ / /g;s/ /_/g')
# PERSON1=${PEOPLE[0]}
# echo "Person 1: ${PERSON1}"
N_PEOPLE=${#PEOPLE[@]}
# Form new paper name
if [ "$N_PEOPLE" -eq "1" ]; then
# 1 author
PEOPLE_STR=${PEOPLE[0]}
elif [ "$N_PEOPLE" -eq "2" ]; then
# 2 authors
PEOPLE_STR="${PEOPLE[0]}_${PEOPLE[1]}"
else
# More than 2 authors
PEOPLE_STR="${PEOPLE[0]}_etal"
fi
# Get lowercase firstname of author
AUTHOR_SUMM=$(echo "$AUTHOR" | awk '{print tolower($1);}')
DATE_SUMM=$(date "+%Y%m%d")
# Form filename
FILENAME="${DATE_SUMM}-${PEOPLE_STR}_${AUTHOR_SUMM}.md"
cat > "${FILENAME}" << EOF
# ${TITLE}
*Date: ${NOW} ${AUTHOR}*
*Attendees: ${ATTENDEES}, ${AUTHOR}*
*Location: ${PLACE}*
## Actions
- Foo
- Foo2
## Agenda
1.
2.
3.
4. Next actions/mtg
## Talking Points
1.
2.
3.
## Discussion
<!-- markdownlint-disable-file MD009 MD012 MD013 MD029 MD036 -->
<!-- markdownlint-disable-file MD009 MD012 MD013 MD036 -->
<!-- MD009 - no trailing spaces -->
<!-- MD012 - no multiple blanks -->
<!-- MD013 - line limit -->
<!-- MD036 - emphasised text as heading -->
EOF