blob: 2972870e4386118d620719097e6afacbba0e8b34 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#compdef mozilla mozilla-firefox mozilla-xremote-client firefox iceweasel=firefox
local curcontext="$curcontext" state line expl ret=1 suf
typeset -A opt_args
local popts="-installer -CreateProfile -P -ProfileWizard -ProfileManager -SelectProfile"
local -a mozopts
if [[ $service = *remote* ]]; then
state=remote
else
if [[ $service != *firefox* ]]; then
mozopts=(
"($popts)-installer[start with 4.x migration window]"
"($popts)-CreateProfile:profile"
"($popts)-ProfileWizard[start with profile wizard]"
"($popts)-SelectProfile[start with profile selection dialog]"
'-splash[enable splash screen]'
'-chat[start with IRC client]'
'-news[start with news]'
'-venkman[start with JavaScript debugger]'
'-terminal[start with command line terminal]'
'-mail[start with mail]'
'-compose[start with messenger compose]:URL:_urls'
)
fi
_x_arguments -C $mozopts \
'-height[height of startup window]:height' \
'(-)'{-h,-help}'[show usage message]' \
'-width[width of startup window]:width' \
'(-)'{-v,-version}'[show the version number and build date]' \
"($popts)-P[start with profile]:profile:->profile" \
"($popts)-ProfileManager[start with profile manager]" \
'-UILocale:locale' \
'-contentLocale:locale' \
'-remote[execute a command in an existing Mozilla]:remote command:->remote' \
'-jsconsole[start with JavaScript Console]' \
'-edit[start with editor]:URL:_urls' \
'-chrome[load the specified chrome]:URL:_urls' \
'*:location:->urls' && ret=0
fi
[[ "$state" = "urls" ]] &&
_files "$@" && return 0
# Handle mozilla remote commands
if [[ "$state" = "remote" ]]; then
local -a remote_commands
remote_commands=(openURL openFile saveAs mailto addBookmark ping)
compset -P '*\('
if compset -S '(|\\)\)*'; then
set - -S "" "$@"
else
set - -S"${${QIPREFIX:+)}:-\)}$compstate[quote] " "$@"
fi
case $IPREFIX in
openURL*)
if compset -P "*,"; then
_wanted option expl 'option' compadd "$@" new-tab new-window && ret=0
else
compset -S ',*'
state=urls
fi
;;
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
# Complete mozilla 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
fi
fi
if [[ $state == "profile" ]]; then
if [[ $service == *firefox* ]]; then
local -a profiles text profiledir
case "$OSTYPE" in
darwin*) profiledir=~/"Library/Application Support/Firefox" ;;
*) profiledir=~/.mozilla/firefox/ ;;
esac
profiles=(${(f)"$(< ${profiledir}/profiles.ini)"})
profiles=(${(M)${profiles}:#(\[Profile|(Path|Name)=)*})
text=${(F)profiles}
profiles=(${(f)text//(#b)\[Profile([0-9]##)\]
Name=([^
]##|)
Path=([^
]##|)/$match[2]})
profiles=(${profiles%:})
compadd $profiles
else
compadd ~/.mozilla/*/*.slt(\:h\:t)
fi
fi
return ret
|