all repos — dotfiles @ eacb75f6caa562215027753ccfed29ae8bf7dcbd

linux dotfiles

scripts(zet): add slug filename
Prithu Goswami pg@prithu.dev
Fri, 26 Jan 2024 13:46:08 +0530
commit

eacb75f6caa562215027753ccfed29ae8bf7dcbd

parent

6abbfdfbe0ec5914d73713aaa22eff590c69008c

1 files changed, 5 insertions(+), 1 deletions(-)

jump to
M bin/scripts/zetbin/scripts/zet

@@ -16,9 +16,13 @@ printf '%s: %s %s\n' `basename $a` "${title/\# }" "$tags"

done } +slugify(){ + echo $@ | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z | sed 's/-$//' +} + create(){ title="$@" - filename="`date +%Y%m%d%H%M`.md" + filename="`date +%Y%m%d%H%M`-$(slugify $title).md" printf "# %s\n\n\n" "$title" > $ZET_DIR/$filename vim +3 $ZET_DIR/$filename t=$(cat $ZET_DIR/$filename | head -1)