summaryrefslogtreecommitdiffstats
path: root/.local/bin/idea
blob: e2853a198b13f185d75353f275219ed48a8ee0f3 (plain)
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
#!/bin/sh -e

if [ -z "$1" ]; then
	read -r thought
elif [ -f "$1" ]; then
	thought=$(cat "$1")
else
	thought="$*"
fi

date=$(date)
html_fmt='\t\t\t\t<h3>'"${date}"'<\/h3>\
\t\t\t\t<p>\
\t\t\t\t\t'"${thought}"'\
\t\t\t\t<\/p>\
'
gmi_fmt='\
\
## '"${date}"'\
\
'"${thought}"

sed -i '' -e '/<!-- thoughts here -->$/{n;s/^/'"${html_fmt}"'/;}' \
	"$HOME"/dev/web/jozanofastora.xyz/thoughts.html
git -C "$HOME"/dev/web/jozanofastora.xyz add -u
git -C "$HOME"/dev/web/jozanofastora.xyz commit -m "Thought: ${date}"
git -C "$HOME"/dev/web/jozanofastora.xyz push

sed -i '' -e '15i '"${gmi_fmt}" \
	"$HOME"/dev/web/jozan_gemini/thoughts.gmi
git -C "$HOME"/dev/web/jozan_gemini add -u
git -C "$HOME"/dev/web/jozan_gemini commit -m "Thought: ${date}"
git -C "$HOME"/dev/web/jozan_gemini push

vps