scripts(zet): add slug filename
Prithu Goswami pg@prithu.dev
Fri, 26 Jan 2024 13:46:08 +0530
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
bin/scripts/zet
→
bin/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)