From c7765222e537076cc17aa18847046309ed3350f4 Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Mon, 8 Oct 2018 09:20:28 +0900 Subject: [PATCH] refactor: use basename to remove path refix more reliably; fix #462 --- fisher.fish | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fisher.fish b/fisher.fish index 31f256d..a69409e 100644 --- a/fisher.fish +++ b/fisher.fish @@ -262,8 +262,8 @@ function _fisher_pkg_fetch_all end for pkg in $local_pkgs - set -l path "local/$USER" - set -l name (echo "$pkg" | command sed 's|^.*/||') + set -l path local/$USER + set -l name (command basename $pkg) command mkdir -p $fisher_config/$path command ln -sf $pkg $fisher_config/$path @@ -290,10 +290,10 @@ function _fisher_pkg_get_deps end function _fisher_pkg_install -a pkg - set -l name (echo $pkg | command sed "s|^.*/||") + set -l name (command basename $pkg) set -l files $pkg/{functions,completions,conf.d}/* $pkg/*.fish for source in $files - set -l target (echo "$source" | command sed 's|^.*/||') + set -l target (command basename $source) switch $source case $pkg/conf.d\* set target $fisher_path/conf.d/$target @@ -319,11 +319,11 @@ function _fisher_pkg_install -a pkg end function _fisher_pkg_uninstall -a pkg - set -l name (echo $pkg | command sed "s|^.*/||") + set -l name (command basename $pkg) set -l files $pkg/{conf.d,completions,functions}/* $pkg/*.fish for source in $files - set -l target (echo "$source" | command sed 's|^.*/||') - set -l filename (echo "$target" | command sed 's|.fish||') + set -l target (command basename $source) + set -l filename (command basename $target .fish) switch $source case $pkg/conf.d\* test "$filename.fish" = "$target"; and emit "$filename"_uninstall