From bf44c45cd5631eab1a5641991d88d4ddf348dd8a Mon Sep 17 00:00:00 2001 From: Derek Stavis Date: Sun, 1 Nov 2015 22:38:07 -0200 Subject: [PATCH] autoload: Use set -e to remove path from destination --- lib/autoload.fish | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/autoload.fish b/lib/autoload.fish index 86a7815..c5312eb 100644 --- a/lib/autoload.fish +++ b/lib/autoload.fish @@ -43,16 +43,10 @@ function autoload -d "Manipulate autoloading path components" end if set -q erase - not contains -- "$path" $$dest; and continue - # Make a copy of function path selected above - 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 + if set -l index (contains -i -- $path $$dest) + set -e {$dest}[$index] + set return_success + end else set return_success contains -- "$path" $$dest; and continue