[glib/wip/oholy/gio-completion: 2/3] gio: Complete also activation roots of volumes



commit 8bc52105ef1dc298db7094962b732e03adc260fd
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Oct 3 14:58:52 2019 +0200

    gio: Complete also activation roots of volumes
    
    Currently, "gio mount google-drive<tab>" isn't completed even though
    that volume exists for google-drive://oholy redhat com/. Let's use
    "gio mount -li" output to complete also activation roots of volumes.

 gio/completion/gio | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/completion/gio b/gio/completion/gio
index 1e6ef7e8d..33c0f5bdd 100644
--- a/gio/completion/gio
+++ b/gio/completion/gio
@@ -47,7 +47,7 @@ __gio_location() {
         dir=${cur%$(basename "$cur")}
     fi
 
-    # List daemon mounts, just if dir is not specified, or looks like scheme
+    # 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
@@ -56,7 +56,7 @@ __gio_location() {
 
             # Use only matching mounts
             [[ "$mount" =~ ^"$cur" && "$mount" != "$cur" ]] && mounts+=("$mount")
-        done < <(gio mount -l | sed -n -r 's/^ *Mount\([0-9]+\): .* -> (.*)$/\1/p')
+        done < <(gio mount -li | sed -n -r 's/^ *(default_location|activation_root)=(.*)$/\2/p' | sort -u)
     fi
 
     # Workaround to unescape dir name (e.g. "\ " -> " ")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]