about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:13:15 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:13:15 +0000
commitf9fe751bfc868fbac37544479a0be78f9862e7b4 (patch)
treef86e24a544a975cc2e6e3015e484939bd6bac932
parentbdb91af0b9e0634fde2d07def9ba5cc15f73749f (diff)
downloadzsh-f9fe751bfc868fbac37544479a0be78f9862e7b4.tar.gz
zsh-f9fe751bfc868fbac37544479a0be78f9862e7b4.tar.xz
zsh-f9fe751bfc868fbac37544479a0be78f9862e7b4.zip
moved from Completion/X/_x_arguments
-rw-r--r--Completion/X/Utility/_x_arguments35
1 files changed, 35 insertions, 0 deletions
diff --git a/Completion/X/Utility/_x_arguments b/Completion/X/Utility/_x_arguments
new file mode 100644
index 000000000..8f1723cc6
--- /dev/null
+++ b/Completion/X/Utility/_x_arguments
@@ -0,0 +1,35 @@
+#compdef -P */X11(|R[456])/*
+
+local ret long xargs opts rawret nm="$compstate[nmatches]"
+
+xargs=(
+  '-display:display:_x_display'
+  '-geometry:geometry:_x_geometry'
+)
+
+(( $# )) || xargs=( "$xargs[@]" '*:default: _default' )
+
+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