about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/X/Command/_mozilla55
2 files changed, 45 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index f02c18c7f..5c1fd9137 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-15  Felix Rosencrantz <f.rosencrantz@gmail.com>
+
+	* 21611: Completion/X/Command/_mozilla: Added Firefox support.
+
 2005-08-15  Peter Stephenson  <pws@csr.com>
 
 	* 21610: Src/system.h, Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c,
diff --git a/Completion/X/Command/_mozilla b/Completion/X/Command/_mozilla
index 890aa7b53..ff0f23bf0 100644
--- a/Completion/X/Command/_mozilla
+++ b/Completion/X/Command/_mozilla
@@ -1,37 +1,42 @@
-#compdef mozilla mozilla-firefox mozilla-xremote-client
+#compdef mozilla mozilla-firefox mozilla-xremote-client 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
-  _x_arguments -C \
+  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]' \
-    "($popts)-installer[start with 4.x migration window]" \
     '-width[width of startup window]:width' \
     '(-)'{-v,-version}'[show the version number and build date]' \
-    "($popts)-CreateProfile:profile" \
-    "($popts)-P[start with profile]:profile:compadd ~/.mozilla/*/*.slt(\:h\:t)" \
-    "($popts)-ProfileWizard[start with profile wizard]" \
+    "($popts)-P[start with profile]:profile:->profile" \
     "($popts)-ProfileManager[start with profile manager]" \
-    "($popts)-SelectProfile[start with profile selection dialog]" \
     '-UILocale:locale' \
     '-contentLocale:locale' \
     '-remote[execute a command in an existing Mozilla]:remote command:->remote' \
-    '-splash[enable splash screen]' \
-    '-chat[start with IRC client]' \
-    '-news[start with news]' \
     '-jsconsole[start with JavaScript Console]' \
-    '-venkman[start with JavaScript debugger]' \
-    '-terminal[start with command line terminal]' \
     '-edit[start with editor]:URL:_urls' \
     '-chrome[load the specified chrome]:URL:_urls' \
-    '-mail[start with mail]' \
-    '-compose[start with messenger compose]:URL:_urls' \
     '*:location:->urls' && ret=0
 fi
 
@@ -104,4 +109,26 @@ if [[ "$state" = "urls" ]]; then
   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