summaryrefslogtreecommitdiffstats
path: root/completions/firefox
blob: 4656f8df4dcf60ba2bc5585f94a07e50c9b15f04 (plain)
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
# firefox completion                                       -*- shell-script -*-

_firefox()
{
    local cur prev words cword split
    _init_completion -s || return

    [[ $cur == -MOZ_LOG*=* ]] && prev=${cur%%=*} cur=${cur#*=}

    case $prev in
        --help | --version | --display | --UILocale | -MOZ_LOG | --new-window | --new-tab | \
            --private-window | --window-size | --search | --start-debugger-server | \
            --recording | --debugger-args | -[hvPa])
            return
            ;;
        --profile | --screenshot)
            _filedir -d
            return
            ;;
        -MOZ_LOG_FILE)
            _filedir log
            return
            ;;
        --recording-file)
            _filedir
            return
            ;;
        --debugger | -d)
            COMPREPLY=($(compgen -c -- "$cur"))
            return
            ;;
    esac

    $split && return

    if [[ $cur == -* ]]; then
        COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
        return
    fi

    _filedir "@(?([xs])htm?(l)|pdf|txt)"
} &&
    complete -F _firefox firefox mozilla-firefox iceweasel

# ex: filetype=sh