Skip to content

Commit

Permalink
Add script to add seminar
Browse files Browse the repository at this point in the history
  • Loading branch information
dspinellis committed May 29, 2024
1 parent 7e22d24 commit 54129fa
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions bin/seminar-add
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
#
# Add a new seminar
#
# Copyright 2024 Diomidis Spinellis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Fail on command errors and unset variables
set -eu

# Display usage information and exit
usage()
{
cat <<EOF 1>&2
Usage: $(basename $0) yyyy-mm-dd
EOF
exit 1
}

if [ $# != 1 ] || ! echo $1 | grep -qE '^[0-9]{4}-[0-9]{2}-[0-9]{2}$' ; then
usage
fi

if [[ "${PWD##*/}" != "seminars" ]] ; then
echo Command must run in the seminars directory 1>&2
exit 1
fi

cat >$1.md <<EOF
title:
presenter:
date: $1
time:
category: seminars
#### Biography
EOF

0 comments on commit 54129fa

Please sign in to comment.