chiark / gitweb /
shell-completion: udev - add net_id
[elogind.git] / shell-completion / systemd-bash-completion.sh
1 # This file is part of systemd.
2 #
3 # Copyright 2010 Ran Benita
4 #
5 # systemd is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
9 #
10 # systemd is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
17
18 __systemctl() {
19         systemctl --full --no-legend "$@"
20 }
21
22 __contains_word () {
23         local word=$1; shift
24         for w in $*; do [[ $w = $word ]] && return 0; done
25         return 1
26 }
27
28 __filter_units_by_property () {
29         local property=$1 value=$2 ; shift 2
30         local units=("$@")
31         local props
32         IFS=$'\n' read -rd '' -a props < \
33             <(__systemctl show --property "$property" -- "${units[@]}")
34         for ((i=0; $i < ${#units[*]}; i++)); do
35                 if [[ "${props[i]}" = "$property=$value" ]]; then
36                         printf "%s\n" "${units[i]}"
37                 fi
38         done
39 }
40
41 __get_all_units      () { __systemctl list-units --all \
42         | { while read -r a b; do printf "%s\n" "$a"; done; }; }
43 __get_active_units   () { __systemctl list-units       \
44         | { while read -r a b; do printf "%s\n" "$a"; done; }; }
45 __get_inactive_units () { __systemctl list-units --all \
46         | { while read -r a b c d; do [[ $c == "inactive" ]] && printf "%s\n" "$a"; done; }; }
47 __get_failed_units   () { __systemctl list-units       \
48         | { while read -r a b c d; do [[ $c == "failed"   ]] && printf "%s\n" "$a"; done; }; }
49 __get_enabled_units  () { __systemctl list-unit-files  \
50         | { while read -r a b c  ; do [[ $b == "enabled"  ]] && printf "%s\n" "$a"; done; }; }
51 __get_disabled_units () { __systemctl list-unit-files  \
52         | { while read -r a b c  ; do [[ $b == "disabled" ]] && printf "%s\n" "$a"; done; }; }
53 __get_masked_units   () { __systemctl list-unit-files  \
54         | { while read -r a b c  ; do [[ $b == "masked"   ]] && printf "%s\n" "$a"; done; }; }
55
56 _systemctl () {
57         local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
58         local i verb comps
59
60         local -A OPTS=(
61                [STANDALONE]='--all -a --defaults --fail --ignore-dependencies --failed --force -f --full --global
62                              --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
63                              --order --require --quiet -q --privileged -P --system --user --version --runtime'
64                       [ARG]='--host -H --kill-mode --kill-who --property -p --signal -s --type -t --root'
65         )
66
67         if __contains_word "$prev" ${OPTS[ARG]}; then
68                 case $prev in
69                         --signal|-s)
70                                 comps=$(compgen -A signal)
71                         ;;
72                         --type|-t)
73                                 comps='automount device mount path service snapshot socket swap target timer'
74                         ;;
75                         --kill-who)
76                                 comps='all control main'
77                         ;;
78                         --kill-mode)
79                                 comps='control-group process'
80                         ;;
81                         --root)
82                                 comps=$(compgen -A directory -- "$cur" )
83                                 compopt -o filenames
84                         ;;
85                         --host|-H)
86                                 comps=$(compgen -A hostname)
87                         ;;
88                         --property|-p)
89                                 comps=''
90                         ;;
91                 esac
92                 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
93                 return 0
94         fi
95
96
97         if [[ "$cur" = -* ]]; then
98                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
99                 return 0
100         fi
101
102         local -A VERBS=(
103                 [ALL_UNITS]='is-active is-enabled status show mask preset'
104             [ENABLED_UNITS]='disable reenable'
105            [DISABLED_UNITS]='enable'
106              [FAILED_UNITS]='reset-failed'
107           [STARTABLE_UNITS]='start'
108           [STOPPABLE_UNITS]='stop condstop kill try-restart condrestart'
109          [ISOLATABLE_UNITS]='isolate'
110          [RELOADABLE_UNITS]='reload condreload reload-or-try-restart force-reload'
111         [RESTARTABLE_UNITS]='restart reload-or-restart'
112              [MASKED_UNITS]='unmask'
113                      [JOBS]='cancel'
114                 [SNAPSHOTS]='delete'
115                      [ENVS]='set-environment unset-environment'
116                [STANDALONE]='daemon-reexec daemon-reload default dot dump
117                              emergency exit halt kexec list-jobs list-units
118                              list-unit-files poweroff reboot rescue show-environment'
119                      [NAME]='snapshot load'
120                      [FILE]='link'
121         )
122
123         for ((i=0; $i <= $COMP_CWORD; i++)); do
124                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
125                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
126                         verb=${COMP_WORDS[i]}
127                         break
128                 fi
129         done
130
131         if   [[ -z $verb ]]; then
132                 comps="${VERBS[*]}"
133
134         elif __contains_word "$verb" ${VERBS[ALL_UNITS]}; then
135                 comps=$( __get_all_units )
136
137         elif __contains_word "$verb" ${VERBS[ENABLED_UNITS]}; then
138                 comps=$( __get_enabled_units )
139
140         elif __contains_word "$verb" ${VERBS[DISABLED_UNITS]}; then
141                 comps=$( __get_disabled_units )
142
143         elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
144                 comps=$( __filter_units_by_property CanStart yes \
145                       $( __get_inactive_units \
146                         | while read -r line; do \
147                                 [[ "$line" =~ \.(device|snapshot)$ ]] || printf "%s\n" "$line"; \
148                         done ))
149
150         elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
151                 comps=$( __filter_units_by_property CanStart yes \
152                       $( __get_all_units \
153                         | while read -r line; do \
154                                 [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || printf "%s\n" "$line"; \
155                         done ))
156
157         elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
158                 comps=$( __filter_units_by_property CanStop yes \
159                       $( __get_active_units ) )
160
161         elif __contains_word "$verb" ${VERBS[RELOADABLE_UNITS]}; then
162                 comps=$( __filter_units_by_property CanReload yes \
163                       $( __get_active_units ) )
164
165         elif __contains_word "$verb" ${VERBS[ISOLATABLE_UNITS]}; then
166                 comps=$( __filter_units_by_property AllowIsolate yes \
167                       $( __get_all_units ) )
168
169         elif __contains_word "$verb" ${VERBS[FAILED_UNITS]}; then
170                 comps=$( __get_failed_units )
171
172         elif __contains_word "$verb" ${VERBS[MASKED_UNITS]}; then
173                 comps=$( __get_masked_units )
174
175         elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[NAME]}; then
176                 comps=''
177
178         elif __contains_word "$verb" ${VERBS[JOBS]}; then
179                 comps=$( __systemctl list-jobs | { while read -r a b; do printf "%s\n" "$a"; done; } )
180
181         elif __contains_word "$verb" ${VERBS[SNAPSHOTS]}; then
182                 comps=$( __systemctl list-units --type snapshot --full --all \
183                         | { while read -r a b; do printf "%s\n" "$a"; done; } )
184
185         elif __contains_word "$verb" ${VERBS[ENVS]}; then
186                 comps=$( __systemctl show-environment \
187                     | while read -r line; do printf "%s\n" "${line%%=*}=";done )
188                 compopt -o nospace
189
190         elif __contains_word "$verb" ${VERBS[FILE]}; then
191                 comps=$( compgen -A file -- "$cur" )
192                 compopt -o filenames
193         fi
194
195         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
196         return 0
197 }
198 complete -F _systemctl systemctl
199
200 __get_all_sessions () { loginctl list-sessions | { while read -r a b; do printf "%s\n" "$a"; done; } ; }
201 __get_all_users    () { loginctl list-users    | { while read -r a b; do printf "%s\n" "$b"; done; } ; }
202 __get_all_seats    () { loginctl list-seats    | { while read -r a b; do printf "%s\n" "$a"; done; } ; }
203
204 _loginctl () {
205         local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
206         local i verb comps
207
208         local -A OPTS=(
209                [STANDALONE]='--all -a --help -h --no-pager --privileged -P --version'
210                       [ARG]='--host -H --kill-who --property -p --signal -s'
211         )
212
213         if __contains_word "$prev" ${OPTS[ARG]}; then
214                 case $prev in
215                         --signal|-s)
216                                 comps=$(compgen -A signal)
217                         ;;
218                         --kill-who)
219                                 comps='all leader'
220                         ;;
221                         --host|-H)
222                                 comps=$(compgen -A hostname)
223                         ;;
224                         --property|-p)
225                                 comps=''
226                         ;;
227                 esac
228                 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
229                 return 0
230         fi
231
232
233         if [[ "$cur" = -* ]]; then
234                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
235                 return 0
236         fi
237
238         local -A VERBS=(
239                 [SESSIONS]='session-status show-session activate lock-session unlock-session terminate-session kill-session'
240                 [USERS]='user-status show-user enable-linger disable-linger terminate-user kill-user'
241                 [SEATS]='seat-status show-seat terminate-seat'
242                 [STANDALONE]='list-sessions list-users list-seats flush-devices'
243                 [ATTACH]='attach'
244         )
245
246         for ((i=0; $i <= $COMP_CWORD; i++)); do
247                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
248                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
249                         verb=${COMP_WORDS[i]}
250                         break
251                 fi
252         done
253
254         if   [[ -z $verb ]]; then
255                 comps="${VERBS[*]}"
256
257         elif __contains_word "$verb" ${VERBS[SESSIONS]}; then
258                 comps=$( __get_all_sessions )
259
260         elif __contains_word "$verb" ${VERBS[USERS]}; then
261                 comps=$( __get_all_users )
262
263         elif __contains_word "$verb" ${VERBS[SEATS]}; then
264                 comps=$( __get_all_seats )
265
266         elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
267                 comps=''
268
269         elif __contains_word "$verb" ${VERBS[ATTACH]}; then
270                 if [[ $prev = $verb ]]; then
271                         comps=$( __get_all_seats )
272                 else
273                         comps=$(compgen -A file -- "$cur" )
274                         compopt -o filenames
275                 fi
276         fi
277
278         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
279         return 0
280 }
281 complete -F _loginctl loginctl
282
283 __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
284                   ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE
285                   _{P,U,G}ID _COMM _EXE _CMDLINE
286                   _AUDIT_{SESSION,LOGINUID}
287                   _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
288                   _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
289                   _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
290                   _KERNEL_{DEVICE,SUBSYSTEM}
291                   _UDEV_{SYSNAME,DEVNODE,DEVLINK}
292                   __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
293
294 _journalctl() {
295         local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
296         local -A OPTS=(
297                 [STANDALONE]='-a --all --full
298                               -b --this-boot --disk-usage -f --follow --header
299                               -h --help -l --local --new-id128 -m --merge --no-pager
300                               --no-tail -q --quiet --setup-keys --this-boot --verify
301                               --version --list-catalog --update-catalog'
302                        [ARG]='-D --directory -F --field -o --output -u --unit'
303                 [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until
304                               --verify-key'
305         )
306
307         if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then
308                 case $prev in
309                         --directory|-D)
310                                 comps=$(compgen -d -- "$cur")
311                                 compopt -o filenames
312                         ;;
313                         --output|-o)
314                                 comps='short short-monotonic verbose export json cat'
315                         ;;
316                         --field|-F)
317                                 comps=${__journal_fields[*]}
318                         ;;
319                         --unit|-u)
320                                 comps=$(journalctl -F '_SYSTEMD_UNIT')
321                         ;;
322                         *)
323                                 return 0
324                         ;;
325                 esac
326                 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
327                 return 0
328         fi
329
330         if [[ $cur = -* ]]; then
331                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
332                 return 0
333         elif [[ $cur = *=* ]]; then
334                 mapfile -t field_vals < <(journalctl -F "${prev%=}" 2>/dev/null)
335                 COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") )
336         elif [[ $prev = '=' ]]; then
337                 mapfile -t field_vals < <(journalctl -F "${COMP_WORDS[COMP_CWORD-2]}" 2>/dev/null)
338                 COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "$cur") )
339         else
340                 compopt -o nospace
341                 COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") )
342         fi
343 }
344 complete -F _journalctl journalctl
345
346 _coredumpctl() {
347         local i verb comps
348         local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
349         local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field'
350
351         local -A VERBS=(
352             [LIST]='list'
353             [DUMP]='dump gdb'
354         )
355
356         if __contains_word "$prev" '--output -o'; then
357                 comps=$( compgen -A file -- "$cur" )
358                 compopt -o filenames
359         elif __contains_word "$prev" '--FIELD -F'; then
360                 comps=$( compgen -W '${__journal_fields[*]}' -- "$cur" )
361         elif [[ $cur = -* ]]; then
362                 comps=${OPTS}
363         elif __contains_word "$prev" ${VERBS[*]} &&
364            ! __contains_word ${COMP_WORDS[COMP_CWORD-2]} '--output -o -F --field'; then
365                 compopt -o nospace
366                 COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") )
367                return 0
368         elif [[ $cur = *=* ]]; then
369                 mapfile -t field_vals < <(systemd-coredumpctl -F "${prev%=}" 2>/dev/null)
370                 COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "${cur#=}") )
371                 return 0
372         elif [[ $prev = '=' ]]; then
373                 mapfile -t field_vals < <(systemd-coredumpctl -F "${COMP_WORDS[COMP_CWORD-2]}" 2>/dev/null)
374                 comps=${field_vals[*]}
375         else
376                 for ((i=0; i <= COMP_CWORD; i++)); do
377                         if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
378                                 verb=${COMP_WORDS[i]}
379                                 break
380                         fi
381                 done
382
383                 if [[ -z $verb ]]; then
384                         comps=${VERBS[*]}
385                 elif __contains_word "$verb" ${VERBS[LIST]} ${VERBS[DUMP]}; then
386                         comps=''
387                 fi
388         fi
389
390         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
391         return 0
392 }
393 complete -F _coredumpctl systemd-coredumpctl
394
395 _timedatectl() {
396         local i verb comps
397         local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
398         local OPTS='-h --help --version --adjust-system-clock --no-pager
399                     --no-ask-password -H --host'
400
401         if __contains_word "$prev" $OPTS; then
402                 case $prev in
403                         --host|-H)
404                                 comps=''
405                         ;;
406                 esac
407                 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
408                 return 0
409         fi
410
411         if [[ $cur = -* ]]; then
412                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
413                 return 0
414         fi
415
416         local -A VERBS=(
417                   [BOOLEAN]='set-local-rtc set-ntp'
418                [STANDALONE]='status set-time list-timezones'
419                 [TIMEZONES]='set-timezone'
420                      [TIME]='set-time'
421         )
422
423         for ((i=0; i <= COMP_CWORD; i++)); do
424                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
425                         verb=${COMP_WORDS[i]}
426                         break
427                 fi
428         done
429
430         if [[ -z $verb ]]; then
431                 comps=${VERBS[*]}
432         elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then
433                 comps='true false'
434         elif __contains_word "$verb" ${VERBS[TIMEZONES]}; then
435                 comps=$(command timedatectl list-timezones)
436         elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[TIME]}; then
437                 comps=''
438         fi
439
440         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
441         return 0
442 }
443 complete -F _timedatectl timedatectl
444
445 _localectl() {
446         local i verb comps
447         local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
448         local OPTS='-h --help --version --no-convert --no-pager --no-ask-password
449                     -H --host'
450
451         if __contains_word "$prev" $OPTS; then
452                 case $prev in
453                         --host|-H)
454                                 comps=''
455                         ;;
456                 esac
457                 COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
458                 return 0
459         fi
460
461         if [[ $cur = -* ]]; then
462                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
463                 return 0
464         fi
465
466         local -A VERBS=(
467                [STANDALONE]='status list-locales list-keymaps'
468                   [LOCALES]='set-locale'
469                   [KEYMAPS]='set-keymap'
470                       [X11]='set-x11-keymap'
471         )
472
473         for ((i=0; i <= COMP_CWORD; i++)); do
474                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
475                         verb=${COMP_WORDS[i]}
476                         break
477                 fi
478         done
479
480         if [[ -z $verb ]]; then
481                 comps=${VERBS[*]}
482         elif __contains_word "$verb" ${VERBS[LOCALES]}; then
483                 comps=$(command localectl list-locales)
484         elif __contains_word "$verb" ${VERBS[KEYMAPS]}; then
485                 comps=$(command localectl list-keymaps)
486         elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[X11]}; then
487                 comps=''
488         fi
489
490         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
491         return 0
492 }
493 complete -F _localectl localectl
494
495 _hostnamectl() {
496         local i verb comps
497         local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
498         local OPTS='-h --help --version --transient --static --pretty
499                     --no-ask-password -H --host'
500
501         if [[ $cur = -* ]]; then
502                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
503                 return 0
504         fi
505
506         local -A VERBS=(
507                 [STANDALONE]='status'
508                      [ICONS]='set-icon-name'
509                       [NAME]='set-hostname'
510         )
511
512         for ((i=0; i <= COMP_CWORD; i++)); do
513                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
514                         verb=${COMP_WORDS[i]}
515                         break
516                 fi
517         done
518
519         if [[ -z $verb ]]; then
520                 comps=${VERBS[*]}
521         elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then
522                 comps=''
523         fi
524
525         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
526         return 0
527 }
528 complete -F _hostnamectl hostnamectl
529
530 __get_all_sysdevs() {
531         local -a devs=(/sys/bus/*/devices/*/ /sys/class/*/*/)
532         printf '%s\n' "${devs[@]%/}"
533 }
534
535 _udevadm() {
536         local i verb comps
537         local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
538         local OPTS='-h --help --version --debug'
539
540         local -A VERBS=(
541                 [INFO]='info'
542                 [TRIGGER]='trigger'
543                 [SETTLE]='settle'
544                 [CONTROL]='control'
545                 [MONITOR]='monitor'
546                 [HWDB]='hwdb'
547                 [TESTBUILTIN]='test-builtin'
548                 [TEST]='test'
549         )
550
551         for ((i=0; $i <= $COMP_CWORD; i++)); do
552                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
553                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
554                         verb=${COMP_WORDS[i]}
555                         break
556                 fi
557         done
558
559         if [[ -z $verb  && $cur = -* ]]; then
560                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
561                 return 0
562         fi
563
564         if [[ -z $verb ]]; then
565                 comps=${VERBS[*]}
566
567         elif __contains_word "$verb" ${VERBS[INFO]}; then
568                 if [[ $cur = -* ]]; then
569                         comps='--help --query= --path= --name= --root --attribute-walk --export-db --cleanup-db'
570                 else
571                         comps=$( __get_all_sysdevs )
572                 fi
573
574         elif __contains_word "$verb" ${VERBS[TRIGGER]}; then
575                 comps='--help --verbose --dry-run --type= --action= --subsystem-match=
576                        --subsystem-nomatch= --attr-match= --attr-nomatch= --property-match=
577                        --tag-match= --sysname-match= --parent-match='
578
579         elif __contains_word "$verb" ${VERBS[SETTLE]}; then
580                 comps='--help --timeout= --seq-start= --seq-end= --exit-if-exists= --quiet'
581
582         elif __contains_word "$verb" ${VERBS[CONTROL]}; then
583                 comps='--help --exit --log-priority= --stop-exec-queue --start-exec-queue
584                        --reload --property= --children-max= --timeout='
585
586         elif __contains_word "$verb" ${VERBS[MONITOR]}; then
587                 comps='--help --kernel --udev --property --subsystem-match= --tag-match='
588
589         elif __contains_word "$verb" ${VERBS[HWDB]}; then
590                 comps='--help --update --test='
591
592         elif __contains_word "$verb" ${VERBS[TEST]}; then
593                 if [[ $cur = -* ]]; then
594                         comps='--help --action='
595                 else
596                         comps=$( __get_all_sysdevs )
597                 fi
598
599         elif __contains_word "$verb" ${VERBS[TESTBUILTIN]}; then
600                       comps='blkid btrfs firmware hwdb input_id kmod net_id path_id usb_id uaccess'
601         fi
602
603         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
604         return 0
605 }
606 complete -F _udevadm udevadm