about summary refs log tree commit diff stats
path: root/dot_config/bash
diff options
context:
space:
mode:
authorVitor Gonçalves <vitorg@tilde.team>2023-06-26 03:53:50 -0300
committerVitor Gonçalves <vitorg@tilde.team>2023-06-26 03:53:50 -0300
commit6e7059129b385b0aee732960903b2faab98e167c (patch)
tree4b19b31c303f50f9ecf1fed42e612809b7199a34 /dot_config/bash
parent6939f3fe61e1696dc11603451d786f0990ffdbc2 (diff)
downloaddots-6e7059129b385b0aee732960903b2faab98e167c.tar.gz
feat: added wbp function
Diffstat (limited to 'dot_config/bash')
-rw-r--r--dot_config/bash/functions11
-rw-r--r--dot_config/bash/rc1
2 files changed, 12 insertions, 0 deletions
diff --git a/dot_config/bash/functions b/dot_config/bash/functions
new file mode 100644
index 0000000..c0f45fb
--- /dev/null
+++ b/dot_config/bash/functions
@@ -0,0 +1,11 @@
+# vim: ft=sh
+
+wbp() {
+    blogdir="$HOME/docs/src/web/blog"
+
+    read -rp "What is your title? " title
+
+    path="$blogdir/content/$(date '+%Y-%m-%d')-$title.md"
+    "$EDITOR" "$path"
+    clear; printf "Your blogpost is saved at $path.\n"
+}
diff --git a/dot_config/bash/rc b/dot_config/bash/rc
index 40a6b72..f8f7b01 100644
--- a/dot_config/bash/rc
+++ b/dot_config/bash/rc
@@ -9,4 +9,5 @@ export GPG_TTY=$(tty)
 export EDITOR="nvim" VISUAL="nvim"
 
 source "$HOME/.config/bash/aliases"
+source "$HOME/.config/bash/functions"
 source "$HOME/.config/bash/prompt"