1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-03 09:21:19 +02:00
zsh/Completion/User/_netscape

91 lines
2.7 KiB
Plaintext
Raw Normal View History

1999-10-13 15:47:21 +02:00
#compdef netscape
local curcontext="$curcontext" state line ret=1 suf
2000-04-01 22:43:43 +02:00
typeset -A opt_args
1999-10-13 15:47:21 +02:00
2000-04-01 22:43:43 +02:00
_x_arguments -C \
1999-10-13 15:47:21 +02:00
'-xrm:resource:_x_resource' \
'-help[show usage message]' \
'-version[show the version number and build date]' \
'-visual[use a specific server visual]:id-or-number:' \
'-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} \
2000-04-01 22:43:43 +02:00
'*:location:->urls' && ret=0
[[ "$state" = "urls" ]] &&
_files "$@" && return 0
1999-10-13 15:47:21 +02:00
# Handle netscape remote commands
2000-04-01 22:43:43 +02:00
if [[ "$state" = "remote" ]]; then
1999-10-13 15:47:21 +02:00
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
1999-10-13 15:47:21 +02:00
case $IPREFIX in
2000-04-01 22:43:43 +02:00
openURL*|addBookmark*) state=urls;;
openFile*) _files "$@" -W ~;;
2000-04-01 22:43:43 +02:00
saveAs*)
1999-10-13 15:47:21 +02:00
if compset -P "*,"; then
2000-04-01 22:43:43 +02:00
_wanted types expl 'data type' \
compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript && ret=0
1999-10-13 15:47:21 +02:00
else
compset -S ",*" || suf=","
_files -qS "$suf" -W ~ && ret=0
1999-10-13 15:47:21 +02:00
fi
;;
2000-04-01 22:43:43 +02:00
mailto*)
1999-10-13 15:47:21 +02:00
compset -P "*,"
if compset -P '*@'; then
2000-04-01 22:43:43 +02:00
_wanted hosts expl 'remote host name' _hosts -q -S, && ret=0
1999-10-13 15:47:21 +02:00
else
compset -S "@*" || suf="@"
_wanted users expl 'login name' _users -q -S "$suf" && ret=0
1999-10-13 15:47:21 +02:00
fi
;;
2000-04-01 22:43:43 +02:00
*)
compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
_wanted commands expl 'remote commands' \
2000-05-31 11:38:25 +02:00
compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
remote_commands && ret=0
1999-10-13 15:47:21 +02:00
;;
esac
fi
2000-04-01 22:43:43 +02:00
if [[ "$state" = "urls" ]]; then
1999-10-13 15:47:21 +02:00
# Complete netscape urls
2000-04-01 22:43:43 +02:00
if compset -P about: ; then
_wanted values expl 'about what' \
compadd "$@" authors blank cache document fonts global hype image-cache \
2000-04-01 22:43:43 +02:00
license logo memory-cache mozilla plugins && ret=0
1999-10-13 15:47:21 +02:00
else
_tags prefixes
while _tags; do
while _next_label prefixes expl 'URL prefix' "$@"; do
_urls "$expl[@]" && ret=0
compset -S '[^:]*'
compadd -S '' "$expl[@]" about: mocha: javascript: && ret=0
2000-04-01 22:43:43 +02:00
done
(( ret )) || return 0
done
1999-10-13 15:47:21 +02:00
fi
fi
2000-04-01 22:43:43 +02:00
return ret