]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/rfkill
Merge branch 'lsclocks/relative-time' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / bash-completion / rfkill
CommitLineData
9bf5e08f
SK
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
33833562 8 'list'|'block'|'unblock'|'toggle')
9bf5e08f
SK
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
33833562 36 toggle
9bf5e08f
SK
37 --json
38 --noheadings
39 --output
4dfd172d 40 --output-all
9bf5e08f
SK
41 --raw
42 --help
43 --version
44 "
45 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
46 return 0
47
48}
49complete -F _rfkill_module rfkill