about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2004-02-20 10:56:11 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2004-02-20 10:56:11 +0000
commit01c29ffd950352f7ce638fb9e75778bc1bb20454 (patch)
tree918da11873829c52a0615027403ef4cce8371d80
parent1e13a63092874656ba2a8bd5f90762de45a9cda0 (diff)
downloadzsh-01c29ffd950352f7ce638fb9e75778bc1bb20454.tar.gz
zsh-01c29ffd950352f7ce638fb9e75778bc1bb20454.tar.xz
zsh-01c29ffd950352f7ce638fb9e75778bc1bb20454.zip
19455: complete hostnames and nfs mounts
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_mount16
2 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 008a36e84..88271576c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-20  Oliver Kiddle  <opk@zsh.org>
+
+	* 19455: Completion/Unix/Command/_mount: complete hostnames
+	and nfs mounts
+
 2004-02-19  Clint Adams  <schizo@debian.org>
 
 	* unposted: Completion/Debian/Command/_bts: patch from
diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount
index 17bce8023..653d7d7c2 100644
--- a/Completion/Unix/Command/_mount
+++ b/Completion/Unix/Command/_mount
@@ -750,6 +750,17 @@ fsopt)
 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 @@ devordir)
     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 @@ devordir)
     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