From 35b2633ad941966f5fca07b625a594a5b68c0fdb Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Mon, 15 Nov 1999 12:01:46 +0000 Subject: manual/8639 --- Completion/X/_x_arguments | 19 ++++++++++++---- Completion/X/_x_color | 13 +++++------ Completion/X/_x_cursor | 6 ++--- Completion/X/_x_display | 4 +--- Completion/X/_x_extension | 4 +--- Completion/X/_x_font | 3 +-- Completion/X/_x_keysym | 3 +-- Completion/X/_x_modifier | 8 +++---- Completion/X/_x_window | 2 +- Completion/X/_xmodmap | 7 +++--- Completion/X/_xt_arguments | 57 +++++++++++++++++++++++++++------------------- Completion/X/_xutils | 12 +++++----- 12 files changed, 72 insertions(+), 66 deletions(-) (limited to 'Completion/X') diff --git a/Completion/X/_x_arguments b/Completion/X/_x_arguments index 396a39ea2..b820b50b0 100644 --- a/Completion/X/_x_arguments +++ b/Completion/X/_x_arguments @@ -1,11 +1,20 @@ #compdef -P */X11/* -local ret +local ret long xargs -_arguments \ - '-display:display:_x_display' \ - '-geometry:geometry:_x_geometry' \ - "$@" +xargs=( + '-display:display:_x_display' + '-geometry:geometry:_x_geometry' +) + +long=$argv[(I)--] +if (( long )); then + argv[long]=( "$xargs[@]" -- ) +else + set -- "$@" "$xargs[@]" +fi + +_arguments "$@" ret=$? diff --git a/Completion/X/_x_color b/Completion/X/_x_color index 4c1c73bf4..2daeb51d6 100644 --- a/Completion/X/_x_color +++ b/Completion/X/_x_color @@ -15,8 +15,9 @@ if (( ! $+_color_cache )); then # Cache of color names doesn't exist yet, create it. - if [[ -n "$compconfig[colors_path]" ]]; then - _color_cache=( "${(@)${(@f)$(< $compconfig[colors_path])}[2,-1]##* }" ) + _style -s colors path file + if [[ -n "$file" ]]; then + _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##* }" ) else file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt(N) ) @@ -29,8 +30,6 @@ if (( ! $+_color_cache )); then (( $#_color_cache )) || _color_cache=(white black gray red blue green) fi -_tags any colors || return 1 - -_description expl 'color specification' -compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} m:-=\ r:|[ A-Z0-9]=* r:|=*' - \ - "$_color_cache[@]" +_wanted colors expl 'color specification' && + compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} m:-=\ r:|[ A-Z0-9]=* r:|=*' - \ + "$_color_cache[@]" diff --git a/Completion/X/_x_cursor b/Completion/X/_x_cursor index a22189f9d..8b057a537 100644 --- a/Completion/X/_x_cursor +++ b/Completion/X/_x_cursor @@ -14,7 +14,5 @@ if (( ! $+_cursor_cache )); then fi fi -_tags any cursors || return 1 - -_description expl 'cursor name' -compadd "$@" "$expl[@]" -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]" +_wanted cursors expl 'cursor name' && + compadd "$@" "$expl[@]" -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]" diff --git a/Completion/X/_x_display b/Completion/X/_x_display index 7b9fbab9a..f547a64fa 100644 --- a/Completion/X/_x_display +++ b/Completion/X/_x_display @@ -1,5 +1,3 @@ #autoload -_tags any displays || return 1 - -_hosts -S ':0 ' -r : +_tags displays && _hosts -S ':0 ' -r : diff --git a/Completion/X/_x_extension b/Completion/X/_x_extension index 44e47d956..9321f4951 100644 --- a/Completion/X/_x_extension +++ b/Completion/X/_x_extension @@ -2,12 +2,10 @@ local expl -_tags any extensions || return 1 +_wanted extensions expl 'X extensions' || return 1 (( $+_xe_cache )) || _xe_cache=( "${(@)${(@f)$(xdpyinfo)}[(r)number of extensions:*,-1][2,(r)default screen number:*][1,-2]//[ ]}" ) -_description expl 'X extension' - if [[ "$1" = -a ]]; then shift diff --git a/Completion/X/_x_font b/Completion/X/_x_font index f4dfef79c..59c628d6d 100644 --- a/Completion/X/_x_font +++ b/Completion/X/_x_font @@ -2,7 +2,7 @@ local expl -_tags any fonts || return 1 +_wanted fonts expl font || return 1 # This *has* to be improved some day... @@ -12,5 +12,4 @@ if (( ! $+_font_cache )); then _font_cache=( "${(@)^${(@f)$(xlsfonts)}%%--*}--" ) fi -_description expl font compadd -M 'r:|-=* r:|=*' "$expl[@]" "$@" -S '' - "$_font_cache[@]" diff --git a/Completion/X/_x_keysym b/Completion/X/_x_keysym index fc2847c57..2e8f037b1 100644 --- a/Completion/X/_x_keysym +++ b/Completion/X/_x_keysym @@ -2,7 +2,7 @@ local expl -_tags any keysyms || return 1 +_wanted keysyms expl 'key symbol' || return 1 if (( ! $+_keysym_cache )); then local file @@ -18,5 +18,4 @@ if (( ! $+_keysym_cache )); then fi fi -_description expl 'key symbol' compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - $_keysym_cache diff --git a/Completion/X/_x_modifier b/Completion/X/_x_modifier index 345243835..01052da65 100644 --- a/Completion/X/_x_modifier +++ b/Completion/X/_x_modifier @@ -2,8 +2,6 @@ local expl -_tags any modifiers || return 1 - -_description expl modifier -compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' - \ - Shift Lock Control Mod1 Mod2 Mod3 Mod4 Mod5 +_wanted modifiers expl modifier && + compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' - \ + Shift Lock Control Mod1 Mod2 Mod3 Mod4 Mod5 diff --git a/Completion/X/_x_window b/Completion/X/_x_window index 6d6e3112e..bf0ad4d33 100644 --- a/Completion/X/_x_window +++ b/Completion/X/_x_window @@ -2,7 +2,7 @@ local list expl -_tags any windows || return 1 +_tags windows || return 1 list=( "${(@)${(M@)${(@f)$(xwininfo -root -tree)}:#[ ]#0x[0-9a-f]# \"*}##[ ]#}" ) diff --git a/Completion/X/_xmodmap b/Completion/X/_xmodmap index d8ba420ce..e1594b949 100644 --- a/Completion/X/_xmodmap +++ b/Completion/X/_xmodmap @@ -1,9 +1,9 @@ #compdef xmodmap -local context state line ret=1 +local curcontext="$curcontext" state line ret=1 typeset -A opt_args -_x_arguments \ +_x_arguments -C \ -{help,grammar,verbose,quiet} \ '-n[only show what would be done]' \ '*-e[specify expression]:expression:->expr' \ @@ -82,8 +82,7 @@ if [[ -n "$state" ]]; then [[ "$what" = *ksym* ]] && _x_keysym "$suf[@]" && ret=0 else - if _tags any commands; then - _description expl command + if _wanted commands expl command; then compadd "$expl[@]" -S ' ' keycode keysym clear add remove && ret=0 compadd "$expl[@]" -S ' = ' pointer && ret=0 fi diff --git a/Completion/X/_xt_arguments b/Completion/X/_xt_arguments index 2604cfa83..4b40500f3 100644 --- a/Completion/X/_xt_arguments +++ b/Completion/X/_xt_arguments @@ -20,30 +20,39 @@ # cf. XrmParseCommand(3X11), X11R6.4/xc/lib/Xt/Initialize.c, X(5) -local ret - -_arguments \ - -+{rv,synchronous} \ - -{reverse,iconic} \ - '-background:background color:_x_color' \ - '-bd:border color:_x_color' \ - '-bg:background color:_x_color' \ - '-bordercolor:border color:_x_color' \ - '-borderwidth:border width:_x_borderwidth' \ - '-bw:border width:_x_borderwidth' \ - '-display:display:_x_display' \ - '-fg:foreground color:_x_color' \ - '-font:font:_x_font' \ - '-fn:font:_x_font' \ - '-foreground:foreground color:_x_color' \ - '-geometry:geometry:_x_geometry' \ - '-name:name:_x_name' \ - '-selectionTimeout:selection timeout (milliseconds):_x_selection_timeout' \ - '-title:title:_x_title' \ - '-xnllanguage:locale:_x_locale' \ - '-xrm:resource:_x_resource' \ - '-xtsessionID:session ID:_xt_session_id' \ - "$@" +local ret long xargs + +xargs=( + -+{rv,synchronous} + -{reverse,iconic} + '-background:background color:_x_color' + '-bd:border color:_x_color' + '-bg:background color:_x_color' + '-bordercolor:border color:_x_color' + '-borderwidth:border width:_x_borderwidth' + '-bw:border width:_x_borderwidth' + '-display:display:_x_display' + '-fg:foreground color:_x_color' + '-font:font:_x_font' + '-fn:font:_x_font' + '-foreground:foreground color:_x_color' + '-geometry:geometry:_x_geometry' + '-name:name:_x_name' + '-selectionTimeout:selection timeout (milliseconds):_x_selection_timeout' + '-title:title:_x_title' + '-xnllanguage:locale:_x_locale' + '-xrm:resource:_x_resource' + '-xtsessionID:session ID:_xt_session_id' +) + +long=$argv[(I)--] +if (( long )); then + argv[long]=( "$xargs[@]" -- ) +else + set -- "$@" "$xargs[@]" +fi + +_arguments "$@" ret=$? diff --git a/Completion/X/_xutils b/Completion/X/_xutils index 27518e0cf..ed208dfe5 100644 --- a/Completion/X/_xutils +++ b/Completion/X/_xutils @@ -49,9 +49,9 @@ xhost) local expl type ret=1 if compset -P '-'; then - _description expl 'disallow access' - compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \ - "${${(@M)${(@f)$(xhost)}[2,-1]:#LOCAL:*}#INET:}" + _wanted displays expl 'disallow access' && + compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \ + "${${(@M)${(@f)$(xhost)}[2,-1]:#LOCAL:*}#INET:}" else compset -P + @@ -66,9 +66,9 @@ xhost) krb) _message 'Kerberos V5 principal';; esac else - _description expl 'name family' - compadd -S: - inet dnet nis krb && ret=0 - _hosts && ret=0 + _alternative \ + 'families:name family:compadd -S: - inet dnet nis krb' \ + 'hosts:: _hosts' && ret=0 fi return ret fi -- cgit 1.4.1