Skip to content

Commit

Permalink
Only emit $HOME when not in compatibility mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmc3 committed Jul 18, 2024
1 parent e305f98 commit f828798
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions/__antidote_print_path
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions tests/test_helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f828798

Please sign in to comment.