aboutsummaryrefslogtreecommitdiffstats
path: root/completion/arch-chroot.bash
blob: 707208a98fc181c655c044395282b1dca46878e7 (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
_arch_chroot() {
    compopt +o dirnames
    local cur prev opts i
    _init_completion -n : || return
    opts="-u -h"

    for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do
        if [[ -d ${i} ]]; then
            return 0
        fi
    done

    if [[ ${prev} = -u ]]; then
        _usergroup -u
        return 0
    fi

    if [[ ${cur} = -* ]]; then
        COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
        return 0
    fi
    compopt -o dirnames
}

complete -F _arch_chroot arch-chroot