1 # udevadm(8) completion -*- shell-script -*-
3 # This file is part of systemd.
5 # Copyright 2010 Ran Benita
7 # systemd is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU Lesser General Public License as published by
9 # the Free Software Foundation; either version 2.1 of the License, or
10 # (at your option) any later version.
12 # systemd is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
21 local w word=$1; shift
23 [[ $w = "$word" ]] && return
28 local -a devs=(/sys/bus/*/devices/*/ /sys/class/*/*/)
29 printf '%s\n' "${devs[@]%/}"
34 local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
35 local OPTS='-h --help --version --debug'
37 local verbs=(info trigger settle control monitor hwdb test-builtin test)
39 for ((i=0; i < COMP_CWORD; i++)); do
40 if __contains_word "${COMP_WORDS[i]}" "${verbs[@]}" &&
41 ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
47 if [[ -z $verb ]]; then
48 COMPREPLY=( $(compgen -W '${OPTS[*]} ${verbs[*]}' -- "$cur") )
54 if [[ $cur = -* ]]; then
55 comps='--help --query= --path= --name= --root --attribute-walk --export-db --cleanup-db'
57 comps=$( __get_all_sysdevs )
61 comps='--help --verbose --dry-run --type= --action= --subsystem-match=
62 --subsystem-nomatch= --attr-match= --attr-nomatch= --property-match=
63 --tag-match= --sysname-match= --parent-match='
66 comps='--help --timeout= --seq-start= --seq-end= --exit-if-exists= --quiet'
69 comps='--help --exit --log-priority= --stop-exec-queue --start-exec-queue
70 --reload --property= --children-max= --timeout='
73 comps='--help --kernel --udev --property --subsystem-match= --tag-match='
76 comps='--help --update --test='
79 if [[ $cur = -* ]]; then
80 comps='--help --action='
82 comps=$( __get_all_sysdevs )
86 comps='blkid btrfs hwdb input_id keyboard kmod net_id net_setup_link path_id usb_id uaccess'
93 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
97 complete -F _udevadm udevadm