summaryrefslogtreecommitdiffstats
path: root/completions/mysqladmin
blob: af7d50f90fdaba5fbddf961c538c9ed2ec73fa98 (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
# bash completion for mysqladmin                           -*- shell-script -*-

_comp_cmd_mysqladmin()
{
    local cur prev words cword was_split comp_args
    _comp_initialize -s -- "$@" || return

    local noargopts='!(-*|*[uhScPOiw]*)'
    # shellcheck disable=SC2254
    case $prev in
        --user | -${noargopts}u)
            _comp_compgen -- -u
            return
            ;;
        --host | -${noargopts}h)
            _comp_compgen_known_hosts -- "$cur"
            return
            ;;
        --character-sets-dir | --ssl-capath)
            _comp_compgen_filedir -d
            return
            ;;
        --default-character-set)
            _comp_compgen -x mysql character_sets
            return
            ;;
        --socket | -${noargopts}S)
            _comp_compgen_filedir sock
            return
            ;;
        --defaults-file | --defaults-extra-file)
            _comp_compgen_filedir
            return
            ;;
        --ssl-ca | --ssl-cert)
            _comp_compgen_filedir '@(pem|cer|c?(e)rt)'
            return
            ;;
        --ssl-key)
            _comp_compgen_filedir '@(pem|key)'
            return
            ;;
        --count | --port | --set-variable | --sleep | --ssl-cipher | --wait | \
            --connect_timeout | --shutdown_timeout | -${noargopts}[cPOiw])
            return
            ;;
        --help | --version | -${noargopts}[?V])
            return
            ;;
    esac

    [[ $was_split ]] && return

    _comp_compgen_help

    _comp_compgen -a -- -W 'create debug drop extended-status flush-hosts
        flush-logs flush-status flush-tables flush-threads flush-privileges
        kill password old-password ping processlist reload refresh shutdown
        status start-slave stop-slave variables version'

    [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
} &&
    complete -F _comp_cmd_mysqladmin mysqladmin

# ex: filetype=sh