]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/rfkill
su: use lib/pty-session.c code for --pty
[thirdparty/util-linux.git] / bash-completion / rfkill
1 _rfkill_module()
2 {
3 local cur prev OPTS
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 case $prev in
8 'list'|'block'|'unblock')
9 local targets
10 targets="$(rfkill --output=id,type --noheadings list)"
11 COMPREPLY=( $(compgen -W "all $targets" -- $cur) )
12 return 0;
13 ;;
14 '-o'|'--output')
15 local prefix realcur OUTPUT
16 realcur="${cur##*,}"
17 prefix="${cur%$realcur}"
18 for WORD in "DEVICE TYPE ID SOFT HARD"; do
19 if ! [[ $prefix == *"$WORD"* ]]; then
20 OUTPUT="$WORD ${OUTPUT:-""}"
21 fi
22 done
23 compopt -o nospace
24 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
25 return 0
26 ;;
27 '-h'|'--help'|'-V'|'--version')
28 return 0
29 ;;
30 esac
31 OPTS="
32 event
33 list
34 block
35 unblock
36 --json
37 --noheadings
38 --output
39 --output-all
40 --raw
41 --help
42 --version
43 "
44 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
45 return 0
46
47 }
48 complete -F _rfkill_module rfkill