summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2019-10-03 15:09:56 +0200
committerOndrej Holy <oholy@redhat.com>2019-10-07 09:21:19 +0200
commitb3bf1e263e363da24bc6309a768bb6021ac92f5f (patch)
tree2a3db9779c4975829995153ab50b8abc5b8d8255
parent8bc52105ef1dc298db7094962b732e03adc260fd (diff)
downloadglib-b3bf1e263e363da24bc6309a768bb6021ac92f5f.tar.gz
gio: Always include mounts in the results
Mounts are currently completed only if the prefix looks like scheme, however, this doesn't work well if the mounts have also path component. Let's always include them to fix this issue. The mounts are cached by the volume monitors, so it should not significantly affect the performance.
-rw-r--r--gio/completion/gio20
1 files changed, 9 insertions, 11 deletions
diff --git a/gio/completion/gio b/gio/completion/gio
index 33c0f5bdd..63d3a1279 100644
--- a/gio/completion/gio
+++ b/gio/completion/gio
@@ -47,17 +47,15 @@ __gio_location() {
dir=${cur%$(basename "$cur")}
fi
- # List mounts and volumes, just if dir is not specified, or looks like scheme
- local mounts=()
- if [[ $dir == "" ]] || [[ $dir =~ ":"$ && ! $dir =~ "/" ]]; then
- while IFS=$'\n' read mount; do
- # Do not care about local mounts
- [[ "$mount" =~ ^"file:" ]] && continue
-
- # Use only matching mounts
- [[ "$mount" =~ ^"$cur" && "$mount" != "$cur" ]] && mounts+=("$mount")
- done < <(gio mount -li | sed -n -r 's/^ *(default_location|activation_root)=(.*)$/\2/p' | sort -u)
- fi
+ # List volumes and mounts
+ local mounts=( )
+ while IFS=$'\n' read mount; do
+ # Do not care about local mounts
+ [[ "$mount" =~ ^"file:" ]] && continue
+
+ # Use only matching mounts
+ [[ "$mount" =~ ^"$cur" && "$mount" != "$cur" ]] && mounts+=("$mount")
+ done < <(gio mount -li | sed -n -r 's/^ *(default_location|activation_root)=(.*)$/\2/p' | sort -u)
# Workaround to unescape dir name (e.g. "\ " -> " ")
declare -a tmp="( ${dir} )"