summaryrefslogtreecommitdiff
path: root/Completion/User/_netscape
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User/_netscape')
-rw-r--r--Completion/User/_netscape70
1 files changed, 43 insertions, 27 deletions
diff --git a/Completion/User/_netscape b/Completion/User/_netscape
index f176083d2..b29c27c6c 100644
--- a/Completion/User/_netscape
+++ b/Completion/User/_netscape
@@ -1,8 +1,9 @@
#compdef netscape
-local state
+local curcontext="$curcontext" state line ret=1
+typeset -A opt_args
-_x_arguments \
+_x_arguments -C \
'-xrm:resource:_x_resource' \
'-help[show usage message]' \
'-version[show the version number and build date]' \
@@ -21,55 +22,70 @@ _x_arguments \
-{,no-}{,irix-}session-management \
-{done-save,ignore}-geometry-prefs \
-{component-bar,composer,edit,messenger,mail,discussions,news} \
- '*:location:->urls'
+ '*:location:->urls' && ret=0
+
+[[ "$state" = "urls" ]] &&
+ _files "$@" && return 0
-[ "$state" = "urls" ] && _files "$@" && return
# Handle netscape remote commands
-if [ "$state" = "remote" ]; then
+if [[ "$state" = "remote" ]]; then
local -a remote_commands
remote_commands=(openURL openFile saveAs mailto addBookmark)
[[ $compstate[quoting] = (double|single) ]] && compset -q
compset -P '*\('
case $IPREFIX in
- openURL*|addBookmark* ) state=urls;;
- openFile* ) _files -W ~;;
- saveAs* )
+ openURL*|addBookmark*) state=urls;;
+ openFile*) _files -W ~;;
+ saveAs*)
if compset -P "*,"; then
- compadd -s")" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript
+ _wanted types expl 'data type' \
+ compadd -s")" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript &&
+ ret=0
else
- _path_files -W ~
+ _files -W ~ && ret=0
fi
;;
- mailto* )
+ mailto*)
compset -P "*,"
if compset -P '*@'; then
- _description expl 'remote host name'
- _hosts "$expl[@]" -q -S,
+ _wanted hosts expl 'remote host name' _hosts -q -S, && ret=0
else
- _description expl 'login name'
- _users "$expl[@]" -q -S@
+ _wanted users expl 'login name' _users -q -S@ && ret=0
fi
;;
- * )
- if [ "$QIPREFIX" ]; then
- compadd -q -S '(' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands
- else
- compadd -s'(' -S '' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands
+ *)
+ if _wanted commands; then
+ if [[ -z "$QIPREFIX" ]]; then
+ _all_labels commands expl 'remote commands' \
+ compadd -s'(' -S '' -M 'm:{a-zA-Z}={A-Za-z}' - \
+ $remote_commands && ret=0
+ else
+ _all_labels commands expl 'remote commands' \
+ compadd -qS '(' -M 'm:{a-zA-Z}={A-Za-z}' - \
+ $remote_commands && ret=0
+ fi
fi
;;
esac
fi
-if [ "$state" = "urls" ]; then
+if [[ "$state" = "urls" ]]; then
# Complete netscape urls
- if [[ -prefix about: ]]; then
- compset -P about:
- compadd authors blank cache document fonts global hype image-cache \
- license logo memory-cache mozilla plugins
+ 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
else
- compadd -S '' about: mocha: javascript:
- _urls "$@"
+ if _wanted prefixes; then
+ while _next_label prefixes expl 'URL prefix'; do
+ compadd "$expl[@]" -S '' about: mocha: javascript: && ret=0
+ _urls "$@" && ret=0
+ (( ret )) || return 0
+ done
+ fi
fi
fi
+
+return ret