Improve the `new-post` helper

`new-post 'Livingdocs is on the shortlist for the "Best of Swiss Web
Awards"'` now becomes
parent 764d3654
function new-post() {
NAME=$(echo "$*" | sed -e "s/ /_/g")
# Snake Case, Lower Case and remove non alphanumeric characters
# (except for `.`, `-`, and `_`)
NAME=$(echo "$*" | sed -e "s/ /_/g" | sed -e 's/\(.*\)/\L\1/' | sed "s/[^[:alpha:].-_]//g")
TARGET=resources/posts/$(date -I)_$
TITLE="$*" sh ./.templates/ > $TARGET
echo "Created $TARGET"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment