diff --git a/functions/__antidote_print_path b/functions/__antidote_print_path index e193828..9bce65b 100644 --- a/functions/__antidote_print_path +++ b/functions/__antidote_print_path @@ -1,3 +1,8 @@ #!/bin/zsh ### Pretty print a path -echo "$1" | sed -e "s|^$HOME/|\$HOME/|" + +if zstyle -t ':antidote:compatibility-mode' 'antibody'; then + echo "$1" +else + echo "$1" | sed -e "s|^$HOME/|\$HOME/|" +fi diff --git a/tests/test_helpers.md b/tests/test_helpers.md index fbd9aca..6234cbb 100644 --- a/tests/test_helpers.md +++ b/tests/test_helpers.md @@ -18,6 +18,20 @@ antidote: Blocked attempt to rm path: '/foo/bar'. % ``` +## Pretty print path + +```zsh +% __antidote_print_path /foo/bar +/foo/bar +% __antidote_print_path $HOME/foo/bar +$HOME/foo/bar +% zstyle ':antidote:compatibility-mode' 'antibody' 'on' +% __antidote_print_path $HOME/foo/bar | subenv T_TEMPDIR +$T_TEMPDIR/foo/bar +% zstyle -d ':antidote:compatibility-mode' 'antibody' +% +``` + ## Bundle type ```zsh