aboutsummarylogtreecommitdiffstats
path: root/archforge.bash
blob: 8f9969f699eb7a8cf34d976341260de58a67b34b (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# archforge bash completion

_archforge_completions() {
    local cur prev words cword
    _init_completion || return

    local commands=(
        "generate"
        "build"
        "search"
        "info"
        "deploy"
        "interactive"
        "init"
        "swarm"
        "status"
        "cache"
        "help"
    )

    local generate_opts=(
        "--output"
        "-o"
        "--quiet"
        "-q"
    )

    local build_opts=(
        "--skippgpcheck"
        "-s"
        "--nodeps"
        "-d"
        "--nobuild"
        "-n"
    )

    local search_opts=(
        "--short"
        "--noresults"
        "--rpc"
    )

    local deploy_opts=(
        "aur"
        "docker"
        "flatpak"
        "nix"
    )

    if [[ "$cword" -eq 1 ]]; then
        COMPREPLY=($(compgen -W "${commands[*]}" -- "$cur"))
        return
    fi

    case "${words[1]}" in
        generate)
            COMPREPLY=($(compgen -W "${generate_opts[*]}" -- "$cur"))
            ;;
        build)
            COMPREPLY=($(compgen -W "${build_opts[*]}" -- "$cur"))
            ;;
        search)
            COMPREPLY=($(compgen -W "${search_opts[*]}" -- "$cur"))
            ;;
        deploy)
            COMPREPLY=($(compgen -W "${deploy_opts[*]}" -- "$cur"))
            ;;
    esac
}

complete -F _archforge_completions archforge