Escape home directory used in regex, too!

feature/pretty-pipenv
Justin Hileman 4 years ago
parent 0c3ae9f932
commit 9dd917535a

@ -110,7 +110,7 @@ function __bobthefish_pretty_parent -S -a child_dir -d 'Print a parent directory
# Replace $HOME with ~
set -l real_home ~
set -l parent_dir (string replace -r '^'"$real_home"'($|/)' '~$1' (__bobthefish_dirname $child_dir))
set -l parent_dir (string replace -r '^'(__bobthefish_escape_regex "$real_home")'($|/)' '~$1' (__bobthefish_dirname $child_dir))
# Must check whether `$parent_dir = /` if using native dirname
if [ -z "$parent_dir" ]

Loading…
Cancel
Save