summaryrefslogtreecommitdiff
path: root/bash/blog-zola.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bash/blog-zola.sh')
-rwxr-xr-xbash/blog-zola.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/bash/blog-zola.sh b/bash/blog-zola.sh
index 90f3050..c620789 100755
--- a/bash/blog-zola.sh
+++ b/bash/blog-zola.sh
@@ -55,7 +55,19 @@ new() {
# get basic format
d="$(date +%F)"
+ echo -ne "\x1b[32m"
+ echo -n "existing categories: "
+ grep -wrn content -e "categories" | \
+ awk -F = '{ print $2 }' | \
+ sort | uniq | paste -s -d ' '
+ echo -ne "\x1b[0m"
read -r -p "category: " category
+ echo -ne "\x1b[32m"
+ echo -n "existing tags: "
+ grep -wrn content -e "tags" | \
+ awk -F = '{ print $2 }' | \
+ sort | uniq | paste -s -d ' '
+ echo -ne "\x1b[0m"
read -r -p "tag: " tags
read -r -p "math support [y/n]: " m
if [ "${m,,}" == 'y' ]; then
@@ -76,7 +88,6 @@ math = $math_support
+++
EOF
- vim "$path".md
[ "$?" -eq 0 ] && echo "creation done"
[ "$?" -ne 0 ] && echo "creation fail, please check error" && exit 1
@@ -85,7 +96,7 @@ EOF
fi
read -r -p "do you want to edit now?[y/n] " ans
- [ "${ans,,}" == 'y' ] && vim "$path/$name.md" && echo "edit done"
+ [ "${ans,,}" == 'y' ] && vim "$path.md" && echo "edit done"
push