File: smali

package info (click to toggle)
libsmali-java 2.5.2.git2771eae-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 9,136 kB
  • sloc: java: 47,715; sh: 232; xml: 60; ansic: 46; makefile: 6
file content (71 lines) | stat: -rw-r--r-- 1,528 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
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
# Debian smali completion                             -*- shell-script -*-

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

    local GENERIC_OPTIONS='
        -a --api
        --allow-odex-opcodes
        -h --help
        -j --jobs
        -o --output
        -v --version
    '

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

    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
        -o|--output)
            _filedir
            return 0
            ;;
    esac

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

    # specific command arguments
    if [[ -n $command ]]; then
        case $command in
            assemble|ass|as|a)
                _filedir 'smali'
                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 _smali smali

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