.bash_completion.d/firefox
changeset 734 da0dc50393b6
parent 725 840b60ed51c7
equal deleted inserted replaced
733:32379c87626c 734:da0dc50393b6
     1 # -*- mode: sh; sh-shell-file: bash -*-
     1 # -*- mode: sh; sh-shell-file: bash -*-
     2 
     2 
     3 _firefox()
     3 _firefox()
     4 {
     4 {
     5    local _opts="--sync --g-fatal-warnings -h -help -migration -ProfileManager \
     5   local _opts="--sync --g-fatal-warnings -h -help -migration -ProfileManager \
     6      -no-remote -new-instance -safe-mode -jsconsole -browser -new-window -new-tab -preferences -search \
     6      -no-remote -new-instance -safe-mode -jsconsole -browser -new-window -new-tab -preferences -search \
     7      -recording -recording-output -setDefaultBrowser"
     7      -recording -recording-output -setDefaultBrowser"
     8    local cur prev
     8   local cur prev
     9    cur=${COMP_WORDS[COMP_CWORD]}
     9   cur=${COMP_WORDS[COMP_CWORD]}
    10    [[ $COMP_CWORD != 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
    10   [[ $COMP_CWORD != 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
    11    case "$prev" in
    11   case "$prev" in
    12      -P)
    12     -P)
    13        local profile=~/.mozilla/firefox/profiles.ini
    13       local profile=~/.mozilla/firefox/profiles.ini
    14        if [[ ! -f $profile ]]; then
    14       if [[ ! -f $profile ]]; then
    15          return;
    15           return;
    16        fi
    16       fi
    17        local names=( $(sed -n '/^Name=/{s/^Name=//;p;}' $profile) )
    17       local names=( $(sed -n '/^Name=/{s/^Name=//;p;}' $profile) )
    18        COMPREPLY=( $(compgen -W '${names[@]}' -- "$cur") )
    18       COMPREPLY=( $(compgen -W '${names[@]}' -- "$cur") )
    19        return ;;
    19       return ;;
    20    esac
    20   esac
    21    COMPREPLY=( $(compgen -W '$_opts'  -- $cur) )
    21   COMPREPLY=( $(compgen -W '$_opts'  -- $cur) )
    22    return 0
    22   return 0
    23 } &&
    23 } &&
    24 complete -F _firefox firefox iceweasel
    24     complete -F _firefox firefox iceweasel