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

Re: BUG: Autocompletion for umount doesn't handle spaces in mount points



On 2012/05/18, at 16:18, David Lee wrote:
> Autocompletion for umount lists mount points clipped at the first space. For example, if I have "/Volumes/Media Drive" and "/Volumes/Media Disk", autocomplete for amount will only list a single "/Volumes/Media".

I guess you are using MacOSX, and, yes, this does happen on Mac
(and maybe on other BSD's also).

The following patch may fix the problem (MacOSX only).

The patch also includes two lines of '+  freebsd*|dragonfly*|darwin*)'
to use the same completion for mount/umount options as freebsd.

I have no time to write _fs_xxxx (and devordir) for MacOSX, but
they are necessary only if you use mount command.


Index: Completion/Unix/Command/_mount
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mount,v
retrieving revision 1.31
diff -u -r1.31 _mount
--- Completion/Unix/Command/_mount	1 Mar 2011 20:22:00 -0000	1.31
+++ Completion/Unix/Command/_mount	21 May 2012 15:37:37 -0000
@@ -690,7 +690,7 @@
     deffs=hsfs
     typeops=-F
     ;;
-  freebsd*|dragonfly*)
+  freebsd*|dragonfly*|darwin*)
     args=( -s
       '(:)-a[mount all filesystems in fstab]'
       '-d[cause everything to be done except for the actual system call]'      
@@ -765,7 +765,7 @@
 	'*:dev or dir:->udevordir'
       )
     ;;
-    freebsd*|dragonfly*)
+    freebsd*|dragonfly*|darwin*)
       args=(
 	'(*)-a[unmount all mounted file systems]'
 	'-A[unmount all mounted file systems except the root]'
@@ -904,6 +904,11 @@
       mp_tmp+=( $mline[(w)3] )
     done
   ;;
+  darwin*)
+    tmp=( "${(@f)$(/sbin/mount)}" )
+    dev_tmp=( "${(@)${(@)tmp%% *}:#map}" )
+    mp_tmp=( "${(@)${(@)tmp#* on }%% \(*}" )
+    ;;
   *)
     /sbin/mount | while read mline; do
       mp_tmp+=( $mline[(w)1] )


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