dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit 406c0b07183da6a256b1feca0d82a5f11ee37748
parent cfca47d8096245eaaf1acc1e457aa742db0a8adc
Author: Chris Bracken <chris@bracken.jp>
Date:   Tue,  5 Sep 2017 22:26:25 -0700

On zsh, use smarter path_remove

Split PATH to an array, remove $1, then re-join. Do the same for bash
when I've figured out what the equivalent is in bash land.

Diffstat:
M.paths | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/.paths b/.paths @@ -3,7 +3,13 @@ # Cleanly remove $1 from $PATH path_remove() { - PATH=$(echo $PATH | sed "s:^$1\:::;s:\:$1\::\::;s:\:$1::") + if [ -n "$ZSH_VERSION" ]; then + local paths=("${(s/:/)PATH}") + paths=("${(@)paths:#$1}") + export PATH="${(j/:/)paths}" + else + PATH=$(echo $PATH | sed "s:^$1\:::;s:\:$1\::\::;s:\:$1::") + fi } # Move/add $1 to the start of $PATH