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

PATCH: prefix-needed ignored by _describe -o



The documentation for _describe -o says that it will check, among
others, the prefix-needed style. But it doesn't. This patch makes it do
so. It also adds a completion for renice which uses _describe for
options and thus alerted me to the problem.

Oliver

Index: Completion/Base/Utility/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_describe,v
retrieving revision 1.13
diff -u -r1.13 _describe
--- Completion/Base/Utility/_describe	23 May 2002 12:16:42 -0000
1.13
+++ Completion/Base/Utility/_describe	22 Apr 2003 10:59:47 -0000
@@ -20,6 +20,10 @@
   shift
 fi
 
+[[ "$_type" = options && ! -prefix [-+]* ]] && \
+    zstyle -T ":completion:${curcontext}:options" prefix-needed &&
+        return 1
+
 # Do the tests. `showd' is set if the descriptions should be shown.
 
 zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes
Index: Completion/Unix/Command/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/.distfiles,v
retrieving revision 1.39
diff -u -r1.39 .distfiles
--- Completion/Unix/Command/.distfiles	19 Apr 2003 17:23:47 -0000
1.39
+++ Completion/Unix/Command/.distfiles	22 Apr 2003 10:59:47 -0000
@@ -19,5 +19,5 @@
 _fsh          _chkconfig    _cdcd         _irssi        _mysqldiff
_sccs
 _netcat       _larch        _texinfo	  _figlet       _elinks
_tidy
 _global       _global_tags  _ant          _lsof         _mt
_xmlsoft
-_perforce     _python       _antiword     _screen
+_perforce     _python       _antiword     _screen       _renice
 '
Index: Completion/Unix/Command/_renice
===================================================================
RCS file: Completion/Unix/Command/_renice
diff -N Completion/Unix/Command/_renice
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_renice	22 Apr 2003 10:59:47 -0000
@@ -0,0 +1,22 @@
+#compdef renice
+
+if [[ $CURRENT = 2 ]]; then
+  _message -e priority
*  return
+else
+  local opts ret=1
+  opts=(
+    '-g:interpret args as process group IDs'
+    '-u:interpret args as user names'
+    '-p:interpret args as process IDs'
+  )
+  _describe -o option opts && ret=0
+
+  case ${(v)words[(I)-?]} in
+    -g) _message -e pgids 'process group ID' && ret=0 ;;
+    -u) _users && ret=0 ;;
+    *)  _pids && ret=0;;
+  esac
+fi
+
+return ret



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