Update slugify to a function instead of alias

main
Buddy Sandidge 2 years ago
parent f18433b158
commit 2363afec9d

@ -1,7 +1,5 @@
#ft=sh #ft=sh
alias slugify="sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z"
if type nvim >/dev/null 2>/dev/null ; then if type nvim >/dev/null 2>/dev/null ; then
export EDITOR=nvim export EDITOR=nvim
alias vim=nvim alias vim=nvim
@ -9,6 +7,17 @@ else
export EDITOR=vim export EDITOR=vim
fi fi
slugify () (
if [ "$#" -ne 0 ] ; then
echo "$@" | slugify
else
iconv --to-code ascii//TRANSLIT |
sed -E 's/[^a-zA-Z0-9]+/-/g' |
sed -E 's/^-+\|-+$//g' |
tr '[:upper:]' '[:lower:]'
fi
)
source_env_file () { source_env_file () {
if [ ! -f "${1}" ]; then if [ ! -f "${1}" ]; then
return return

Loading…
Cancel
Save