aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_complete_cd.fish
diff options
context:
space:
mode:
authorGravatar Jörg Thalheim <joerg@higgsboson.tk>2013-11-22 14:12:09 +0100
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-11-26 00:04:31 -0800
commitcb86b8f8fcf64308b6f4599281c6197c547fa32c (patch)
tree86593072236f8da2b8dfbddb140bcd4bc32f02a0 /share/functions/__fish_complete_cd.fish
parent312977d5a663a3153b019d571c6d9150e5a60a86 (diff)
cd completion: handle not accessible directories
Diffstat (limited to 'share/functions/__fish_complete_cd.fish')
-rw-r--r--share/functions/__fish_complete_cd.fish10
1 files changed, 7 insertions, 3 deletions
diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish
index f54b5aaa..64436a21 100644
--- a/share/functions/__fish_complete_cd.fish
+++ b/share/functions/__fish_complete_cd.fish
@@ -30,9 +30,13 @@ function __fish_complete_cd -d "Completions for the cd command"
for i in $mycdpath
# Move to the initial directory first,
# in case the CDPATH directory is relative
+ builtin cd $wd ^/dev/null
+ builtin cd $i ^/dev/null
- builtin cd $wd
- builtin cd $i
+ if test $status -ne 0
+ # directory does not exists or missing permission
+ continue
+ end
# What we would really like to do is skip descriptions if all
# valid paths are in the same directory, but we don't know how to
@@ -45,5 +49,5 @@ function __fish_complete_cd -d "Completions for the cd command"
end
end
- builtin cd $wd
+ builtin cd $wd ^/dev/null
end