From c1dc0ffe4f35aa48a9fbe4e9f5f7252d63634a1c Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sat, 6 May 2000 07:59:52 +0000 Subject: 11223: Completion/Base/_regex_arguments, Completion/Debian/_apt, Completion/X/_xset, Completion/X/_xwit, Doc/Zsh/compsys.yo: _regex_arguments use _alternative. --- Completion/X/_xset | 60 ++++++++++----------- Completion/X/_xwit | 152 +++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 136 insertions(+), 76 deletions(-) (limited to 'Completion/X') diff --git a/Completion/X/_xset b/Completion/X/_xset index 9f94713bb..e96b35aa8 100644 --- a/Completion/X/_xset +++ b/Completion/X/_xset @@ -44,67 +44,67 @@ Font Path: _regex_arguments _xset_parse \ "/$word/" \ - \( "/-d(isplay|)$nul/" "$guard" "/$word/" ':option-display:display:_x_display "$expl[@]"' \ + \( "/-d(isplay|)$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \ \| "/-c$nul/" "$guard" \ \| "/c$nul/" "$guard" \ - \( "/(on|off)$nul/" ':option-c-bool:click:compadd "$expl[@]" on off' \ - \| "/[0-9]##$nul/" ':option-c-volume:volume:_message volume' \ + \( "/(on|off)$nul/" ':option-c-bool:click:(on off)' \ + \| "/[0-9]##$nul/" ':option-c-volume:volume:' \ \| \) \ \| "/-b$nul/" "$guard" \ \| "/b$nul/" "$guard" \ - \( "/(on|off)$nul/" ':option-b-bool:bell:compadd "$expl[@]" on off' \ - \| "/[0-9]##$nul/" ':option-b-volume:bell volume:_message volume' \ - \( "/[0-9]##$nul/" ':option-b-pitch:bell pitch:_message pitch' \ - \( "/[0-9]##$nul/" ':option-b-duration:bell duration:_message duration' \ + \( "/(on|off)$nul/" ':option-b-bool:bell:(on off)' \ + \| "/[0-9]##$nul/" ':option-b-volume:bell volume:' \ + \( "/[0-9]##$nul/" ':option-b-pitch:bell pitch:' \ + \( "/[0-9]##$nul/" ':option-b-duration:bell duration:' \ \| \) \ \| \) \ \| \) \ \| "/bc$nul/" "$guard" \ \| "/-bc$nul/" "$guard" \ - \| "/fp$nul/" "$guard" "/$word/" ':option-fp:font path:compadd "$expl[@]" default rehash' \ - \| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':option-fp-add:font path:compset -P "*,"; _xset_compfpadd' \ - \| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':option-fp-del:font path:compset -P "*,"; _xset_compfpdel' \ + \| "/fp$nul/" "$guard" "/$word/" ':option-fp:font path:(default rehash)' \ + \| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':option-fp-add:font path:{compset -P "*,"; _xset_compfpadd}' \ + \| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':option-fp-del:font path:{compset -P "*,"; _xset_compfpdel}' \ \| "/-led$nul/" "$guard" \ - \( "/[0-9]##$nul/" ':option-led-number:led number:_message "led number"' \ + \( "/[0-9]##$nul/" ':option-led-number:led number:' \ \| \) \ \| "/led$nul/" "$guard" \ - \( "/(on|off)$nul/" ':option-led-bool:led:compadd "$expl[@]" on off' \ - \| "/[0-9]##$nul/" ':option-led-number:led number:_message "led number"' \ + \( "/(on|off)$nul/" ':option-led-bool:led:(on off)' \ + \| "/[0-9]##$nul/" ':option-led-number:led number:' \ \| \) \ \| "/m(ouse|)$nul/" "$guard" \ - \( "/default$nul/" ':option-mouse-default:mouse parameter:compadd "$expl[@]" default' \ - \| "/[0-9]##(/[0-9]##|)$nul/" ':option-mouse-mult-div:accel_mult/accel_div:_message accel_mult/accel_div' \ - \( "/[0-9]##$nul/" ':option-mouse-threshold:threshold:_message threshold' \ + \( "/default$nul/" ':option-mouse-default:mouse parameter:(default)' \ + \| "/[0-9]##(/[0-9]##|)$nul/" ':option-mouse-mult-div:accel_mult/accel_div:' \ + \( "/[0-9]##$nul/" ':option-mouse-threshold:threshold:' \ \| \) \ \| \) \ \| "/[-+]dpms$nul/" "$guard" \ \| "/dpms$nul/" "$guard" \ - \( "/[0-9]##$nul/" ':option-dpms-standby:standby timeout:_message "standby timeout"' \ - \( "/[0-9]##$nul/" ':option-dpms-suspend:suspend timeout:_message "suspend timeout"' \ - \( "/[0-9]##$nul/" ':option-dpms-off:off timeout:_message "off timeout"' \ + \( "/[0-9]##$nul/" ':option-dpms-standby:standby timeout:' \ + \( "/[0-9]##$nul/" ':option-dpms-suspend:suspend timeout:' \ + \( "/[0-9]##$nul/" ':option-dpms-off:off timeout:' \ \| \) \ \| \) \ - \| "/force/" ':option-dpms-force:force DPMS state:compadd "$expl[@]" force' \ - "/(on|standby|suspend|off)$nul/" ':option-dpms-state:DPMS state:compadd "$expl[@]" on standby suspend off' \ + \| "/force$nul/" ':option-dpms-force:force DPMS state:(force)' \ + "/(on|standby|suspend|off)$nul/" ':option-dpms-state:DPMS state:(on standby suspend off)' \ \) \ \| "/s$nul/" "$guard" \ \( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \ - ':option-s:screen saver:compadd "$expl[@]" blank noblank expose noexpose default on activate reset off' \ - \| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:compadd "$expl[@]" off' \| \) \ - \| "/[0-9]##$nul/" ':option-s-timeout:length:_message length' \ - \( "/[0-9]##$nul/" ':option-s-period:period:_message period' \ + ':option-s:screen saver:(blank noblank expose noexpose default on activate reset off)' \ + \| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:(off)' \| \) \ + \| "/[0-9]##$nul/" ':option-s-timeout:length:' \ + \( "/[0-9]##$nul/" ':option-s-period:period:' \ \| \) \ \| \) \ \| "/-r$nul/" "$guard" \ - \( "/[0-9]##$nul/" ':option-r-keycode:keycode:_message keycode' \ + \( "/[0-9]##$nul/" ':option-r-keycode:keycode:' \ \| \) \ \| "/r$nul/" "$guard" \ - \( "/(on|off)$nul/" ':option-r-autorepeat:autorepeat:compadd "$expl[@]" on off' \ - \| "/[0-9]##$nul/" ':option-r-keycode:keycode:_message keycode' \ + \( "/(on|off)$nul/" ':option-r-autorepeat:autorepeat:(on off)' \ + \| "/[0-9]##$nul/" ':option-r-keycode:keycode:' \ \| \) \ \| "/p$nul/" "$guard" \ - "/[0-9]##$nul/" ':option-p-pixel:pixel:_message pixel' \ - "/$word/" ':option-p-color:color:_x_color "$expl[@]"' \ + "/[0-9]##$nul/" ':option-p-pixel:pixel:' \ + "/$word/" ':option-p-color:color:_x_color' \ \| "/(-|)k$nul/" "$guard" \ \| "/(-|)q$nul/" "$guard" \ \| "/[]/" ':options:options:_xset_compopts' \ diff --git a/Completion/X/_xwit b/Completion/X/_xwit index 7ec216e76..3dbce455f 100644 --- a/Completion/X/_xwit +++ b/Completion/X/_xwit @@ -3,7 +3,7 @@ local word=$'[^\0]#\0' local nul=$'\0' -local guard='-_xwit_guard -${match[1]%?}' +local guard='-_xwit_guard ${match[1]%?}' _xwit_guard () { local opt="$1" o @@ -15,58 +15,108 @@ _xwit_guard () { } _xwit_compopts () { - compadd "$expl[@]" - ${(k)no[(R)*~0]} || - compadd "$expl[@]" - ${(k)no} + local expl + local opt tmp + + tmp=() + for opt in ${(k)no[(R)*~0]} + do + if (( $+desc[$opt] )); then + tmp=("$tmp[@]" "$opt:$desc[$opt]") + else + tmp=("$tmp[@]" "$opt") + fi + done + _describe -o options tmp -- || + _describe -o options allopts -- + +# compadd "$expl[@]" - ${(k)no[(R)*~0]} || +# compadd "$expl[@]" - ${(k)no} } _regex_arguments _xwit_parse \ "/$word/" \ - \( \ - "/-/+" \ - \( "/display$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \ - \| "/(sync|pop|open|iconify|unmap|root|current|select|(no|)(save|backingstore|saveunder))$nul/" "$guard" \ - \| "/resize$nul/" "$guard" \ - "/$word/" ':option-resize-width:width:_message width' \ - "/$word/" ':option-resize-height:height:_message height' \ - \| "/rows$nul/" "$guard" "/$word/" ':option-rows:rows:_message rows' \ - \| "/columns$nul/" "$guard" "/$word/" ':option-columns:columns:_message columns' \ - \| "/move$nul/" "$guard" \ - "/$word/" ':option-move-x:x:_message x' \ - "/$word/" ':option-move-y:y:_message y' \ - \| "/rmove$nul/" "$guard" \ - "/$word/" ':option-rmove-x:x:_message x' \ - "/$word/" ':option-rmove-y:y:_message y' \ - \| "/warp$nul/" "$guard" \ - "/$word/" ':option-warp-x:x:_message x' \ - "/$word/" ':option-warp-y:y:_message y' \ - \| "/rwarp$nul/" "$guard" \ - "/$word/" ':option-rwarp-x:x:_message x' \ - "/$word/" ':option-rwarp-y:y:_message y' \ - \| "/colormap$nul/" "$guard" \ - "/$word/" ':option-colormap:colormapid:_x_colormapid' \ - \| "/(name|label)$nul/" "$guard" \ - "/$word/" ':option-name:name:_x_name "$expl[@]"' \ - \| "/iconname$nul/" "$guard" \ - "/$word/" ':option-name:iconname:_x_name "$expl[@]"' \ - \| "/bitmap$nul/" "$guard" \ - "/$word/" ':option-bitmap:bitmap file:_files "$expl[@]" -g \*.xbm' \ - \| "/mask$nul/" "$guard" \ - "/$word/" ':option-mask:mask file:_files "$expl[@]" -g \*.xbm' \ - \| "/iconmove$nul/" "$guard" \ - "/$word/" ':option-iconmove-x:x:_message x' \ - "/$word/" ':option-iconmove-y:y:_message y' \ - \| "/id$nul/" "$guard" "/$word/" ':option-id:window id:_x_window' \ - \| "/(no|)keyrepeat$nul/" "$guard" \ - \( "/[0-9]##$nul/" ':option-keyrepeat-keycode:keycode:[[ -prefix [0-9]# ]] && _message keycode' \ - \( "/-$nul/" "/[0-9]##$nul/" ':option-keyrepeat-last-keycode:last keycode:[[ -prefix [0-9]# ]] && _message "last keycode"' \| \) \) \# \ - \| "/names$nul/" "$guard" \ - "/$word/" ':option-names:window name:_x_window -n' \# \ - \| "/[]/" ':options:option:_xwit_compopts' \ - \) \ + \( "/-display$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \ + \| "/-(sync|pop|open|iconify|unmap|root|current|select|(no|)(save|backingstore|saveunder))$nul/" "$guard" \ + \| "/-resize$nul/" "$guard" \ + "/$word/" ':option-resize-width:width:' \ + "/$word/" ':option-resize-height:height:' \ + \| "/-rows$nul/" "$guard" "/$word/" ':option-rows:rows:' \ + \| "/-columns$nul/" "$guard" "/$word/" ':option-columns:columns:' \ + \| "/-move$nul/" "$guard" \ + "/$word/" ':option-move-x:x:' \ + "/$word/" ':option-move-y:y:' \ + \| "/-rmove$nul/" "$guard" \ + "/$word/" ':option-rmove-x:x:' \ + "/$word/" ':option-rmove-y:y:' \ + \| "/-warp$nul/" "$guard" \ + "/$word/" ':option-warp-x:x:' \ + "/$word/" ':option-warp-y:y:' \ + \| "/-rwarp$nul/" "$guard" \ + "/$word/" ':option-rwarp-x:x:' \ + "/$word/" ':option-rwarp-y:y:' \ + \| "/-colormap$nul/" "$guard" \ + "/$word/" ':option-colormap:colormapid:_x_colormapid' \ + \| "/-(name|label)$nul/" "$guard" \ + "/$word/" ':option-name:name:_x_name' \ + \| "/-iconname$nul/" "$guard" \ + "/$word/" ':option-name:iconname:_x_name' \ + \| "/-bitmap$nul/" "$guard" \ + "/$word/" ':option-bitmap:bitmap file:_files -g *.xbm' \ + \| "/-mask$nul/" "$guard" \ + "/$word/" ':option-mask:mask file:_files -g *.xbm' \ + \| "/-iconmove$nul/" "$guard" \ + "/$word/" ':option-iconmove-x:x:' \ + "/$word/" ':option-iconmove-y:y:' \ + \| "/-id$nul/" "$guard" "/$word/" ':option-id:window id:_x_window' \ + \| "/-(no|)keyrepeat$nul/" "$guard" \ + \( "/[0-9]##$nul/" ':option-keyrepeat-keycode:keycode:{[[ -prefix [0-9]# ]] && _message keycode}' \ + \( "/-$nul/" "/[0-9]##$nul/" \ + ':option-keyrepeat-last-keycode:last keycode:{[[ -prefix [0-9]# ]] && _message "last keycode"}' \| \) \) \# \ + \| "/-names$nul/" "$guard" \ + "/$word/" ':option-names:window name:_x_window -n' \# \ + \| "/[]/" ':options:option:_xwit_compopts' \ \) \# _xwit () { - typeset -A no eo + local expl allopts + typeset -A desc no eo + + desc=( + -display 'specify display' + -sync 'synchronous mode' + -pop 'pop up window' + -open 'pop up window' + -iconify 'iconify window' + -unmap 'iconify window by unmapping' + -root 'select the root window' + -current 'select the window under current pointer' + -select 'select the window interactively' + -save 'activate screen saver' + -backingstore 'enable backingstore' + -saveunder 'enable saveunder' + -nosave 'reset screen saver' + -nobackingstore 'disable backingstore' + -nosaveunder 'disable saveunder' + -resize 'resize window' + -rows 'resize window rows' + -columns 'resize window columns' + -move 'move window' + -rmove 'move window relatively' + -warp 'warp pointer' + -rwarp 'warp pointer relatively' + -colormap 'install colormap' + -name 'specify window name' + -label 'specify window name' + -iconname 'specify icon name' + -bitmap 'specify icon bitmap' + -mask 'specify icon mask' + -iconmove 'move icon' + -id 'select the window by window-ID' + -keyrepeat 'enable keyrepeat' + -nokeyrepeat 'disable keyrepeat' + -names 'select the window by name' + ) no=( -display 1 @@ -102,6 +152,16 @@ _xwit () { -names 1 ) + allopts=() + for opt in ${(k)no} + do + if (( $+desc[$opt] )); then + allopts=("$allopts[@]" "$opt:$desc[$opt]") + else + allopts=("$allopts[@]" "$opt") + fi + done + eo=( -root '-root -current -select -id -names' -current '-root -current -select -id -names' -- cgit 1.4.1