File: km-kvk2ldml.bash-completion

package info (click to toggle)
keyman 18.0.248-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,308 kB
  • sloc: python: 52,784; cpp: 21,289; sh: 7,633; ansic: 4,823; xml: 3,617; perl: 959; makefile: 139; javascript: 138
file content (36 lines) | stat: -rw-r--r-- 985 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
34
35
36
# shellcheck disable=SC2148
# No hashbang for bash completion scripts! They are intended to be sourced, not executed.

_km-kvk2ldml_completions()
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts="-h --help -p --print -k --keys -o --output -v --verbose -vv --veryverbose --version"

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

    case "${prev}" in
        "-o"|"--output")
            local IFS=$'\n'
            compopt -o filenames
            # shellcheck disable=SC2207
            COMPREPLY=( $(compgen -f -- "$cur") )
            return 0
            ;;
        *)
        ;;
    esac

    local IFS=$'\n'
    compopt -o filenames
    # shellcheck disable=SC2207
    COMPREPLY=( $(compgen -f -X "!"*.kvk -- "$cur") $(compgen -d -- "$cur") )
}

complete -F _km-kvk2ldml_completions km-kvk2ldml