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

PATCH: completing devices in _mount



_mount used to do compadd /dev/* for completing devices. This was
annoying because it couldn't complete things like /dev/dsk/c0t0d0s0. In
19244, I tried changing it to use _files but this has problems because
of the /dev prefix and because it is used with _alternative for mount
point completion. Debian bug 223291 (which this fixes) concerns this
problem.

I think the best solution is perhaps this below. A user can always use a
file-patterns style if they want to group mount points separately from
devices.

Oliver

Index: Completion/Unix/Command/_mount
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mount,v
retrieving revision 1.16
diff -u -r1.16 _mount
--- Completion/Unix/Command/_mount	14 Nov 2003 11:56:55 -0000	1.16
+++ Completion/Unix/Command/_mount	16 Dec 2003 15:59:23 -0000
@@ -771,9 +771,11 @@
       'directories:mount point:compadd -a mp_tmp' && ret=0
     ;;
   *)
-    _alternative \
-      'devices:device:_files -P /dev/ -W /dev' \
-      'directories:mount point:_directories' && ret=0
+    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
+    fi
     ;;
   esac
   ;;



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