mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-23 11:21:45 +08:00
Merge pull request #150 from derekstavis/autoload-erase-no-copy
autoload: Use `set -e` to remove components from paths
This commit is contained in:
commit
0ac593a2bb
|
@ -43,16 +43,10 @@ function autoload -d "Manipulate autoloading path components"
|
||||||
end
|
end
|
||||||
|
|
||||||
if set -q erase
|
if set -q erase
|
||||||
not contains -- "$path" $$dest; and continue
|
if set -l index (contains -i -- $path $$dest)
|
||||||
# Make a copy of function path selected above
|
set -e {$dest}[$index]
|
||||||
set -l function_path $$dest
|
|
||||||
|
|
||||||
set -l index (contains -i -- $path $function_path)
|
|
||||||
set -e function_path[$index]
|
|
||||||
|
|
||||||
# Set function path to modified copy
|
|
||||||
set $dest $function_path
|
|
||||||
set return_success
|
set return_success
|
||||||
|
end
|
||||||
else
|
else
|
||||||
set return_success
|
set return_success
|
||||||
contains -- "$path" $$dest; and continue
|
contains -- "$path" $$dest; and continue
|
||||||
|
|
Loading…
Reference in New Issue
Block a user