summaryrefslogtreecommitdiffstats
path: root/completions/insmod
blob: 2c02f3f67d457797bb57b3c70f4b07f51375aa28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Linux insmod(8) completion                               -*- shell-script -*-

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

    # do filename completion for first argument
    if ((cword == 1)); then
        _comp_compgen_filedir '@(?(k)o?(.[gx]z|.zst))'
    else # do module parameter completion
        _comp_compgen_split -- "$(PATH="$PATH:/sbin" modinfo \
            -p "${words[1]}" 2>/dev/null | cut -d: -f1)"
    fi
} &&
    complete -F _comp_cmd_insmod insmod insmod.static

# ex: filetype=sh