From 78e9bb837c258ac0ec7712b3d612cc2f407e731e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:42 +0200 Subject: Merging upstream version 256. Signed-off-by: Daniel Baumann --- shell-completion/bash/udevadm | 44 +++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) (limited to 'shell-completion/bash/udevadm') diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm index 0606160..05f921c 100644 --- a/shell-completion/bash/udevadm +++ b/shell-completion/bash/udevadm @@ -1,3 +1,4 @@ +# shellcheck shell=bash # udevadm(8) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -30,7 +31,7 @@ __get_all_sysdevs() { printf '%s\n' "${devs[@]%/}" } -__get_all_devs() { +__get_all_device_nodes() { local i for i in /dev/* /dev/*/* /dev/*/*/*; do echo $i @@ -42,15 +43,23 @@ __get_all_device_units() { { while read -r a b; do echo "$a"; done; } } +__get_all_devices() { + __get_all_sysdevs + __get_all_device_nodes + __get_all_device_units +} + _udevadm() { local i verb comps builtin local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [COMMON]='-h --help -V --version' [DEBUG]='-d --debug' - [INFO_STANDALONE]='-r --root -a --attribute-walk -x --export -e --export-db -c --cleanup-db - -w --wait-for-initialization --value' - [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file --property' + [INFO_STANDALONE]='-r --root -a --attribute-walk -t --tree -x --export -e --export-db -c --cleanup-db + -w --wait-for-initialization --value --no-pager --initialized-match --initialized-nomatch' + [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file --property + --json --subsystem-match --subsystem-nomatch --attr-match --attr-nomatch --property-match + --tag-match --sysname-match --name-match --parent-match' [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -q --quiet -w --settle --wait-daemon --uuid --initialized-match --initialized-nomatch' [TRIGGER_ARG]='-t --type -c --action -s --subsystem-match -S --subsystem-nomatch @@ -58,7 +67,8 @@ _udevadm() { -g --tag-match -y --sysname-match --name-match -b --parent-match --prioritized-subsystem' [SETTLE]='-t --timeout -E --exit-if-exists' - [CONTROL_STANDALONE]='-e --exit -s --stop-exec-queue -S --start-exec-queue -R --reload --ping' + [CONTROL_STANDALONE]='-e --exit -s --stop-exec-queue -S --start-exec-queue -R --reload --ping + --load-credentials' [CONTROL_ARG]='-l --log-priority -p --property -m --children-max -t --timeout' [MONITOR_STANDALONE]='-k --kernel -u --udev -p --property' [MONITOR_ARG]='-s --subsystem-match -t --tag-match' @@ -100,7 +110,17 @@ _udevadm() { local IFS=$'\n' ;; -n|--name) - comps=$( __get_all_devs ) + comps=$( __get_all_device_nodes ) + ;; + --json) + comps=$( udevadm info --json=help ) + ;; + --parent-match) + comps=$( __get_all_sysdevs ) + local IFS=$'\n' + ;; + --name-match) + comps=$( __get_all_device_nodes ) ;; *) comps='' @@ -113,7 +133,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[INFO_STANDALONE]} ${OPTS[INFO_ARG]}" else - comps=$( __get_all_sysdevs; __get_all_device_units ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -132,7 +152,7 @@ _udevadm() { local IFS=$'\n' ;; --name-match) - comps=$( __get_all_devs ) + comps=$( __get_all_device_nodes ) ;; *) comps='' @@ -145,7 +165,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TRIGGER_STANDALONE]} ${OPTS[TRIGGER_ARG]}" else - comps=$( __get_all_sysdevs; __get_all_device_units ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -215,7 +235,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TEST]}" else - comps=$( __get_all_sysdevs ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -243,7 +263,7 @@ _udevadm() { elif [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TEST_BUILTIN]}" else - comps=$( __get_all_sysdevs ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -287,7 +307,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[WAIT]}" else - comps=$( __get_all_devs ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; -- cgit v1.2.3