File: dad

package info (click to toggle)
debian-dad 1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 100 kB
  • sloc: sh: 133; makefile: 10
file content (33 lines) | stat: -rw-r--r-- 769 bytes parent folder | download | duplicates (2)
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
# Debian dad(1) completion  -*- shell-script -*-

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

    local COMMANDS=(
        "init"
        "update-upstream"
        "update-symbols")

    local command i
    for (( i=0; i < ${#words[@]}-1; i++ )); do
	if [[ ${COMMANDS[@]} =~ ${words[i]} ]]; then
            command=${words[i]}
            break
        fi
    done

    if [ "$command" = "" ]; then
        COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) )
    else
        case $command in
            init)
                COMPREPLY=(
                    $( apt-cache dumpavail | \command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) )
                return 0
                ;;
        esac
    fi

} && complete -F _dad dad