File: pacstrap.bash

package info (click to toggle)
arch-install-scripts 28-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: sh: 537; makefile: 41
file content (38 lines) | stat: -rw-r--r-- 769 bytes parent folder | download
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
if ! declare -F _pacman_pkg > /dev/null; then
    _completion_loader pacman
fi

_pacstrap() {
    compopt +o dirnames +o default
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts="-C -c -D -G -i -K -M -N -P -U -h"

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

    case ${prev} in
        -h)
            return 0
            ;;
        -C)
            compopt -o default
            return 0
            ;;
    esac

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

    compopt -o dirnames
}

complete -F _pacstrap pacstrap