diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:14:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:14:42 +0000 |
commit | 0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3 (patch) | |
tree | ea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /completions/_udevadm | |
parent | Initial commit. (diff) | |
download | bash-completion-0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3.tar.xz bash-completion-0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3.zip |
Adding upstream version 1:2.11.upstream/1%2.11upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | completions/_udevadm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/completions/_udevadm b/completions/_udevadm new file mode 100644 index 0000000..19624be --- /dev/null +++ b/completions/_udevadm @@ -0,0 +1,77 @@ +# udevadm(8) completion -*- shell-script -*- + +# Use of this file is deprecated. Upstream completion is available in +# systemd >= 196, use that instead. + +_udevadm() +{ + local cur prev words cword split + _init_completion -s || return + + local i udevcmd + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} != -* ]]; then + udevcmd=${words[i]} + break + fi + done + + case $prev in + --help | --version | --property | --children-max | --timeout | --seq-start | \ + --seq-end | --attr-match | --attr-nomatch | --parent-match | --property-match | \ + --tag-match | --subsystem-match | --subsystem-nomatch | --sysname-match | \ + --path) + return + ;; + --log-priority) + COMPREPLY=($(compgen -W 'err info debug' -- "$cur")) + return + ;; + --query) + COMPREPLY=($(compgen -W 'name symlink path property all' \ + -- "$cur")) + return + ;; + --name) + cur=${cur:=/dev/} + _filedir + return + ;; + --device-id-of-file | --exit-if-exists) + _filedir + return + ;; + --action) + COMPREPLY=($(compgen -W 'add change remove' -- "$cur")) + return + ;; + --type) + COMPREPLY=($(compgen -W 'devices subsystems failed' -- "$cur")) + return + ;; + esac + + $split && return + + if [[ ! -v udevcmd ]]; then + case $cur in + -*) + COMPREPLY=($(compgen -W '--help --version --debug' -- "$cur")) + ;; + *) + COMPREPLY=($(compgen -W "$("$1" --help 2>/dev/null | + awk '/^[ \t]/ { print $1 }')" -- "$cur")) + ;; + esac + return + fi + + if [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W \ + '$("$1" ${udevcmd-} --help 2>/dev/null | _parse_help -)' -- "$cur")) + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + fi +} && + complete -F _udevadm udevadm + +# ex: filetype=sh |