udevadm: introduce -a|--action option for test-builtin command

As net_setup_link builtin requires that a device action is set for the
sd_device object.
This commit is contained in:
Yu Watanabe
2021-08-18 00:08:08 +09:00
parent 74614801f6
commit 7ce05a8d66
4 changed files with 44 additions and 8 deletions
+12 -1
View File
@@ -61,6 +61,7 @@ _udevadm() {
[MONITOR_STANDALONE]='-k --kernel -u --udev -p --property'
[MONITOR_ARG]='-s --subsystem-match -t --tag-match'
[TEST]='-a --action -N --resolve-names'
[TEST_BUILTIN]='-a --action'
)
local verbs=(info trigger settle control monitor test-builtin test)
@@ -215,6 +216,16 @@ _udevadm() {
;;
'test-builtin')
if __contains_word "$prev" ${OPTS[TEST_BUILTIN]}; then
case $prev in
-a|--action)
comps=$( udevadm test-builtin --action help )
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
for ((i=0; i < COMP_CWORD; i++)); do
if __contains_word "${COMP_WORDS[i]}" "${builtins[@]}"; then
builtin=${COMP_WORDS[i]}
@@ -225,7 +236,7 @@ _udevadm() {
if [[ -z $builtin ]]; then
comps="${builtins[@]}"
elif [[ $cur = -* ]]; then
comps="${OPTS[COMMON]}"
comps="${OPTS[COMMON]} ${OPTS[TEST_BUILTIN]}"
else
comps=$( __get_all_sysdevs )
local IFS=$'\n'