Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: complete nfs mounts in _mount



Mount completion now completes hostnames with devices and uses showmount
to find out exported filesystems on the remote host.

Index: Completion/Unix/Command/_mount
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mount,v
retrieving revision 1.17
diff -u -r1.17 _mount
--- Completion/Unix/Command/_mount	16 Dec 2003 16:23:12 -0000	1.17
+++ Completion/Unix/Command/_mount	20 Feb 2004 10:28:38 -0000
@@ -750,6 +750,17 @@
 devordir)
   local dev_tmp mp_tmp mline
 
+  if compset -P '*:'; then
+    _wanted exports expl 'exported path' compadd \
+	${${(f)"$(path+=( {/usr,}/sbin(N) ) _call_program exports \
+	showmount -e ${IPREFIX%:} 2>/dev/null)"}[2,-1]%% *} && ret=0
+    return ret
+  fi
+  if compset -S ':*'; then
+    _hosts -S '' && ret=0
+    return ret
+  fi
+
   case "$OSTYPE" in
   freebsd*)
     while read mline; do 
@@ -767,6 +778,7 @@
     done < /etc/fstab
 
     _alternative \
+      'hosts:host:_hosts -S :' \
       'devices:device:compadd -a dev_tmp' \
       'directories:mount point:compadd -a mp_tmp' && ret=0
     ;;
@@ -774,7 +786,9 @@
     if (( ${${(s.,.)opt_args[-o]}[(I)loop(|=*)]} )) ; then
       _wanted device-files expl 'loop device file' _files && ret=0
     else
-      _wanted files expl 'device or mount point' _files -g "*(-%,-/)" && ret=0
+      _alternative \
+        'hosts:host:_hosts -S :' \
+        'files:device or mount point:_files -g "*(-%b,-/)"' && ret=0
     fi
     ;;
   esac



Messages sorted by: Reverse Date, Date, Thread, Author