about summary refs log tree commit diff
path: root/Completion/X
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-05-02 03:46:28 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-05-02 03:46:28 +0000
commit2598e0995abf3d3fadc226cbc282f25bfe8e6521 (patch)
treec26795f3890d32ad638e34030e83081603bb1cc7 /Completion/X
parent6a9a6a4fbce997fe53c6886791e5af794d79fd2f (diff)
downloadzsh-2598e0995abf3d3fadc226cbc282f25bfe8e6521.tar.gz
zsh-2598e0995abf3d3fadc226cbc282f25bfe8e6521.tar.xz
zsh-2598e0995abf3d3fadc226cbc282f25bfe8e6521.zip
Merge of workers/{21302,21306,21310}.
Diffstat (limited to 'Completion/X')
-rw-r--r--Completion/X/Command/_netscape93
-rw-r--r--Completion/X/Type/_x_visual10
2 files changed, 103 insertions, 0 deletions
diff --git a/Completion/X/Command/_netscape b/Completion/X/Command/_netscape
new file mode 100644
index 000000000..e1d02ae90
--- /dev/null
+++ b/Completion/X/Command/_netscape
@@ -0,0 +1,93 @@
+#compdef netscape
+
+local curcontext="$curcontext" state line expl ret=1 suf files
+typeset -A opt_args
+
+_x_arguments -C \
+  '-xrm:resource:_x_resource' \
+  '-help[show usage message]' \
+  '-version[show the version number and build date]' \
+  '-visual[use a specific server visual]:visual:_x_visual -b' \
+  '-install[install a private colormap]' \
+  '-no-install[use the default colormap]' \
+  '-ncols[max no. of colors to allocate for images]:n:' \
+  '-mono[force 1-bit-deep image display]' \
+  '-iconic[start up iconified]' \
+  '-remote[execute a command in an existing Netscape]:remote command:->remote' \
+  '-id[id of X window to send remote commands to]:window-id:' \
+  '-raise[raise window following remote command]' \
+  "-noraise[don't raise window following remote command]" \
+  '-nethelp[show nethelp]' \
+  -{dont-force-window-stacking,no-about-splash} \
+  -{,no-}{,irix-}session-management \
+  -{done-save,ignore}-geometry-prefs \
+  -{component-bar,composer,edit,messenger,mail,discussions,news} \
+  '*:location:->urls' && ret=0
+
+# Handle netscape remote commands
+if [[ "$state" = "remote" ]]; then  
+  local -a remote_commands
+  remote_commands=(openURL openFile saveAs mailto addBookmark)
+
+  compset -P '*\('
+  if compset -S '(|\\)\)*'; then
+    set - -S "" "$@"
+  else
+    set - -S"${${QIPREFIX:+)}:-\)}$compstate[quote] " "$@"
+  fi
+  case $IPREFIX in
+    openURL*|addBookmark*) state=urls;;
+    openFile*) _files "$@" -W ~;;
+    saveAs*) 
+      if compset -P "*,"; then
+        _wanted types expl 'data type' \
+            compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript && ret=0
+      else
+        compset -S ",*" || suf=","
+        _files -qS "$suf" -W ~ && ret=0
+      fi
+    ;;
+    mailto*)
+      _email_addresses -s, -c && ret=0
+    ;;
+    *)
+      compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
+      _wanted commands expl 'remote commands' \
+          compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
+                  remote_commands && ret=0
+    ;;
+  esac
+fi
+
+if [[ "$state" = "urls" ]]; then
+  _tags files urls
+  while _tags; do
+    _requested files expl 'file' _files "$@" && files=yes ret=0
+    if _requested urls; then
+      # Complete netscape urls
+      if compset -P about: ; then
+	_wanted values expl 'about what' \
+            compadd "$@" authors blank cache document fonts global hype \
+	    	image-cache license logo memory-cache mozilla plugins && ret=0
+      elif compset -P news: ; then
+	_newsgroups "$@" && ret=0
+      elif compset -P mailto: ; then
+        _email_addresses -c && ret=0
+      else
+	_tags prefixes
+	while _tags; do
+	  while _next_label prefixes expl 'URL prefix' "$@"; do
+            _urls "$expl[@]" && ret=0
+	    compset -S '[^:]*'
+            compadd -S '' "$expl[@]" about: news: mailto: mocha: javascript: && ret=0
+	  done
+	  (( ret )) || return 0
+	done
+        [[ -z "$files" ]] && _tags files
+      fi
+    fi
+    (( ret )) || return 0
+  done
+fi
+
+return ret
diff --git a/Completion/X/Type/_x_visual b/Completion/X/Type/_x_visual
new file mode 100644
index 000000000..b28208444
--- /dev/null
+++ b/Completion/X/Type/_x_visual
@@ -0,0 +1,10 @@
+#autoload
+
+local expl
+
+# with the -b option, include `Best' in the matches
+local best="${argv[(r)-b]:+Best}"
+argv[(i)-b]=()
+
+_wanted visuals expl visual compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' - \
+    $best DirectColor TrueColor PseudoColor StaticColor GrayScale StaticGray