-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish_the_slides.sh
executable file
·59 lines (52 loc) · 1.15 KB
/
publish_the_slides.sh
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
#! /bin/bash
CONTENTPATH="/Users/marianna/Documents/Projects/blog/content/"
TEXT="Here are the slides."
TAGS="talks, slides"
CATEGORY="General"
DATE=`date +%Y-%m-%d`
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-t|--title)
TITLE="$2"
shift # past argument
shift # past value
;;
-x|--text)
TEXT="$2"
shift # past argument
shift # past value
;;
-s|--slides)
SLIDEFILE="$2"
shift # past argument
shift # past value
;;
-a|--tags)
TAGS="$2"
shift # past argument
shift # past value
;;
-c|--category)
CATEGORY="$2"
shift # past argument
shift # past value
;;
esac
done
set -- "${POSITIONAL[@]}"
if [ -n "$TITLE" ] && [ -n "$SLIDEFILE" ]; then
FILENAME=$CONTENTPATH"pages/"$(echo $TITLE | sed 's/ /_/g').md
echo "Title: "$TITLE > $FILENAME
echo "Date: "$DATE >> $FILENAME
echo "Tags: "$TAGS >> $FILENAME
echo "Category: "${CATEGORY}$'\n' >> $FILENAME
echo "[$TEXT]({filename}${SLIDEFILE})" >> $FILENAME
pelican content/
ghp-import output/
git push origin gh-pages
else
echo "Title and slide path are both required."
fi