File: apksigner

package info (click to toggle)
android-platform-tools-apksig 0.8-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,572 kB
  • sloc: java: 14,296; sh: 230; makefile: 30
file content (96 lines) | stat: -rw-r--r-- 2,095 bytes parent folder | download | duplicates (4)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Debian apksigner completion                             -*- shell-script -*-

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

    local GENERIC_OPTIONS='
        --cert
        -h --help
        --in
        --key
        --key-pass
        --ks
        --ks-key-alias
        --ks-pass
        --ks-provider-arg
        --ks-provider-class
        --ks-provider-name
        --ks-type
        --max-sdk-version
        --min-sdk-version
        --next-signer
        --out
        --pass-encoding
        --print-certs
        --v1-signer-name
        --v1-signing-enabled
        --v2-signing-enabled
        -v --verbose
        --Werr
    '

    # see if the user selected a command already
    local COMMANDS=(
        "help"
        "sign"
        "verify"
        "version")

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

    # Complete a --option<SPACE><TAB>
    case $prev in
        --in|--out)
            _filedir '@(apk|jar)'
            return 0
            ;;
        --ks)
            _filedir '@(bks|jks|keystore)'
            return 0
            ;;
    esac

    # supported options per command
    if [[ "$cur" == -* ]]; then
        case $command in
            sign|verify)
                COMPREPLY=( $( compgen -W "$GENERIC_OPTIONS" -- "$cur" ) )
                return 0
                ;;
            help)
                return 0
                ;;
            version)
                return 0
                ;;
        esac
    fi

    # specific command arguments
    if [[ -n $command ]]; then
        case $command in
            sign|verify)
                _filedir '@(apk|jar)'
                return 0
                ;;
        esac
    fi

    # no command yet, show what commands we have
    if [ "$command" = "" ]; then
        COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) )
    fi

    return 0
} &&
complete -F _apksigner apksigner

# ex: ts=4 sw=4 et filetype=sh