diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
commit | f2621414ee5f2f601424c22f00e207903e3b6104 (patch) | |
tree | 56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/modinfo | |
parent | Adding debian version 1:2.11-8. (diff) | |
download | bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/modinfo')
-rw-r--r-- | completions/modinfo | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/completions/modinfo b/completions/modinfo index 009bcf3..5c8d416 100644 --- a/completions/modinfo +++ b/completions/modinfo @@ -1,35 +1,41 @@ # Linux modinfo(8) completion -*- shell-script -*- -_modinfo() +_comp_cmd_modinfo() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return + local noargopts='!(-*|*[Fkb]*)' + # shellcheck disable=SC2254 case "$prev" in - --field | -!(-*)F) - COMPREPLY=($(compgen -W 'alias author depends description - filename firmware license parm srcversion staging vermagic - version' -- "${cur,,}")) + --field | -${noargopts}F) + _comp_compgen -c "${cur,,}" -- -W 'alias author depends description + filename firmware intree license name parm release_date + retpoline sig_hashalgo sig_key signat signer softdep srcversion + staging vermagic version' return ;; - --set-version | -!(-*)k) - _kernel_versions + --set-version | -${noargopts}k) + _comp_compgen_kernel_versions + return + ;; + --basedir | -${noargopts}b) + _comp_compgen_filedir -d return ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - local opts=$(_parse_help "$1") - COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) + _comp_compgen_help || _comp_compgen_usage [[ ${COMPREPLY-} == *= ]] && compopt -o nospace return fi local i version=$(uname -r) for ((i = ${#words[@]} - 1; i > 0; i--)); do - if [[ ${words[i]} == -@(!(-*)k*|-set-version) ]]; then + if [[ ${words[i]} == -@(${noargopts}k*|-set-version) ]]; then version=${words[i + 1]} break fi @@ -37,11 +43,11 @@ _modinfo() # do filename completion if we're giving a path to a module if [[ $cur == @(*/|[.~])* ]]; then - _filedir '@(?(k)o?(.[gx]z))' + _comp_compgen_filedir '@(?(k)o?(.[gx]z|.zst))' else - _modules $version + _comp_compgen_kernel_modules "$version" fi } && - complete -F _modinfo modinfo + complete -F _comp_cmd_modinfo modinfo # ex: filetype=sh |