proj: Add - to the list of valid characters

This commit is contained in:
Salt 2019-01-26 21:36:47 -06:00
parent 88d7a013b1
commit d70af55ef9

View File

@ -11,7 +11,7 @@ proj() {
return 1 return 1
fi fi
# POSIX mandates this external call to sed # POSIX mandates this external call to sed
projname="$(echo "$1" | sed 's/[^ a-zA-Z0-9.]//g')" projname="$(echo "$1" | sed -re 's/[^ a-zA-Z0-9.-]//g')"
projdir="$HOME/Projects/$projname" projdir="$HOME/Projects/$projname"
# Ensure we have a ~/Projects directory # Ensure we have a ~/Projects directory
mkdir -p "$HOME/Projects" > /dev/null 2>&1 mkdir -p "$HOME/Projects" > /dev/null 2>&1
@ -44,7 +44,7 @@ _proj() {
[ "${#COMP_WORDS[@]}" != "2" ] && return 0 [ "${#COMP_WORDS[@]}" != "2" ] && return 0
for dir in "$HOME"/Projects/*; do for dir in "$HOME"/Projects/*; do
reply="$(basename "$dir")" reply="$(basename "$dir")"
reply="${reply//[^ a-zA-Z0-9.]/}" reply="${reply//[^ \-a-zA-Z0-9.]/}"
# shellcheck disable=2179 # shellcheck disable=2179
COMPREPLY+=" $reply" COMPREPLY+=" $reply"
done done