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

PATCH: _arguments and _dpkg



> - an option, say -I, which gives an array of options which are to be
>   ignored but not completed
> - or, probably more more user-friendly, yet another optspec syntax
>   describing options which are to be ignored but not completed; for
>   example, if we find a syntax that starts with a special string for
>   that, one could use <not>${^_dpkg_actions} in the second call to
>   _arguments to make it skip all options described in $_dpkg_options
> 
> I think I prefer the latter (or both). Anyone got an idea for an
> acceptable syntax? Or other suggestions?

I think I prefer the latter too.  In the meantime, I'm using the following
patch.

Unfortunately, with current CVS, this results in anything beginning
with -- followed by the first letter of any of the long options 
covered by the state engine to be not completed.

e.g. dpkg --p<TAB>, dpkg --pu<TAB>, dpkg --pur<TAB>, &c., will all
just insert a space.

Index: Completion/Debian/_dpkg
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Debian/_dpkg,v
retrieving revision 1.5
diff -u -r1.5 _dpkg
--- Completion/Debian/_dpkg	2000/06/13 17:45:56	1.5
+++ Completion/Debian/_dpkg	2000/06/16 15:09:48
@@ -1,7 +1,7 @@
 #compdef dpkg dpkg-deb
 
 local _dpkg_deb_actions _dpkg_common_actions _dpkg_actions _dpkg_options
-local _dpkg_options_recursive
+local _dpkg_options_recursive _dpkg_actions_install _dpkg_actions_record_avail
 local curcontext="$curcontext" context state line expl ret
 typeset -A opt_args
 
@@ -81,6 +81,8 @@
            --{force,refuse,no-force}'--[forcing options]:what:(auto-select downgrade configure-any hold bad-path not-root overwrite overwrite-diverted depends-version depends confnew confold confdef confmiss conflicts architecture overwrite-dir remove-reinstreq remove-essential)')
 
 _dpkg_options_recursive=('(--recursive)-R[recursive]' '(-R)--recursive')
+_dpkg_actions_install=('(--install)-i[install]' '(-i)--install')
+_dpkg_actions_record_avail=('(--record-avail)-A[record available]' '(-A)--record-avail')
 
 case "${words[1]:t}" in
 dpkg)
@@ -102,7 +104,8 @@
 case "$state" in
   install|record_avail)
         _funcall ret _dpkg_$state && return ret
-        _arguments -C -A "-*" -s "$_dpkg_options[@]" \
+        _arguments -C -s "$_dpkg_options[@]" \
+           "${(@e):-\$_dpkg_actions_${state}}" \
 	   - recur \
 	   '(--recursive)-R[recursive]' \
 	   '(-R)--recursive' \



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