Improve generated filenames in mkdraft

This commit is contained in:
arne 2024-07-22 21:32:02 +02:00
commit e8e113b24d

View file

@ -16,7 +16,7 @@ function yes_or_no {
}
title="$@"
path="src/posts/drafts/$(date +%F)-$(echo -n $title | tr 'A-Z' 'a-z' | tr -c '[:alnum:]' -).md"
path="src/posts/drafts/$(date +%F)-$(echo -n $title | tr 'A-Z' 'a-z' | tr -c '[:alnum:]' - | sed -E 's|-+|-|g').md"
if [ -f $path ]; then
yes_or_no "$path already exists! Do you want to overwrite it?" || exit