Make new post work with BLOG_DIR and add dir subcmd
This commit is contained in:
parent
0e31f2d7b5
commit
1b4a98bc2b
@ -5,19 +5,22 @@
|
|||||||
# Relies on BLOG_DIR to be set from environment
|
# Relies on BLOG_DIR to be set from environment
|
||||||
|
|
||||||
hu() {
|
hu() {
|
||||||
echo "$BLOG_DIR"
|
|
||||||
if [ "$1" == "np" ]; then
|
if [ "$1" == "np" ]; then
|
||||||
POST_NAME="$2"
|
POST_NAME="$2"
|
||||||
if [ -z "$POST_NAME" ]; then
|
if [ -z "$POST_NAME" ]; then
|
||||||
read -p "Enter a post title (omitting .md): " POST_NAME
|
read -p "Enter a post title (omitting .md): " POST_NAME
|
||||||
fi
|
fi
|
||||||
hugo new posts/$POST_NAME.md;
|
hugo new -s "$BLOG_DIR" posts/$POST_NAME.md;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "rm" ]; then
|
if [ "$1" == "rm" ]; then
|
||||||
rm "$BLOG_DIR/content/posts/$2.md"
|
rm "$BLOG_DIR/content/posts/$2.md"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$1" == "dir" ]; then
|
||||||
|
echo "$BLOG_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$1" == "ls" ]; then
|
if [ "$1" == "ls" ]; then
|
||||||
hugo list all -s "$BLOG_DIR" | sed 1d | awk -F',' '{print $1, $(NF-4)}' | column -t
|
hugo list all -s "$BLOG_DIR" | sed 1d | awk -F',' '{print $1, $(NF-4)}' | column -t
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user