summary refs log tree commit diff
path: root/Completion/X/_xt_arguments
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-03-27 13:03:49 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-03-27 13:03:49 +0000
commite48f71e2165072a813aa91c11b61dae69afc8c3c (patch)
tree3a6db907a0de31d995bd944d595ab1b49dd445b7 /Completion/X/_xt_arguments
parentaa9c315cc872f86465a83dba3546ee62317297ba (diff)
downloadzsh-e48f71e2165072a813aa91c11b61dae69afc8c3c.tar.gz
zsh-e48f71e2165072a813aa91c11b61dae69afc8c3c.tar.xz
zsh-e48f71e2165072a813aa91c11b61dae69afc8c3c.zip
make _arguments return 300 only if given the -R option (13790)
Diffstat (limited to 'Completion/X/_xt_arguments')
-rw-r--r--Completion/X/_xt_arguments72
1 files changed, 49 insertions, 23 deletions
diff --git a/Completion/X/_xt_arguments b/Completion/X/_xt_arguments
index 02f11e226..e8dafc60c 100644
--- a/Completion/X/_xt_arguments
+++ b/Completion/X/_xt_arguments
@@ -20,26 +20,52 @@
 
 # cf. XrmParseCommand(3X11), X11R6.4/xc/lib/Xt/Initialize.c, X(5)
 
-_arguments \
-  '+rv' '-rv' '-reverse' \
-  '+synchronous' '-synchronous' \
-  '-background:background color:_colors' \
-  '-background:background color:_colors' \
-  '-bd:border color:_colors' \
-  '-bg:background color:_colors' \
-  '-bordercolor:border color:_colors' \
-  '-borderwidth:border width:_x_borderwidth' \
-  '-bw:border width:_x_borderwidth' \
-  '-display:display:_x_display' \
-  '-fg:foreground color:_colors' \
-  '-fn:font:_x_font' \
-  '-foreground:foreground color:_colors' \
-  '-geometry:geometry:_x_geometry' \
-  '-iconic' \
-  '-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 opts rawret nm="$compstate[nmatches]"
+
+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
+
+opts=()
+while [[ $1 = -(O*|[CR]) ]]; do
+  opts=($opts $1)
+  [[ $1 = -R ]] && rawret=yes
+  shift
+done
+
+_arguments -R "$opts[@]" "$@"
+
+ret=$?
+
+if [[ "$ret" = 300 ]]; then
+  compstate[restore]=''
+  [[ -z $rawret ]] && ret=$(( nm == $compstate[nmatches] ))
+fi
+
+return ret