gio: Fix completion of URIs without hostname part

Currently, "gio list file:///h<tab>" doesn't complete "file:///home"
because the result of "dirname file:///h" is not "file:///" but "file:/",
which breaks the consequent logic. Let's subtract basename from the
path in order to workaround this issue.
This commit is contained in:
Ondrej Holy 2019-10-03 14:44:57 +02:00
parent 90bdc2ffb6
commit 3a1492ec4f

View File

@ -43,7 +43,8 @@ __gio_location() {
if [[ $cur =~ "/"$ ]]; then
dir="$cur"
elif [[ $cur =~ "/" ]]; then
dir="$(dirname "$cur")/"
# Subtract basename because dirname cmd doesn't work well with schemes
dir=${cur%$(basename "$cur")}
fi
# List daemon mounts, just if dir is not specified, or looks like scheme