]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/wdctl
su: use lib/pty-session.c code for --pty
[thirdparty/util-linux.git] / bash-completion / wdctl
1 _wdctl_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 '-f'|'--flags')
9 local FLAGS
10 FLAGS="ALARMONLY
11 CARDRESET
12 EXTERN1
13 EXTERN2
14 FANFAULT
15 KEEPALIVEPING
16 MAGICCLOSE
17 OVERHEAT
18 POWEROVER
19 POWERUNDER
20 PRETIMEOUT
21 SETTIMEOUT"
22 COMPREPLY=( $(compgen -W "$FLAGS" -- $cur) )
23 return 0
24 ;;
25 '-o'|'--output')
26 local prefix realcur OUTPUT_ALL OUTPUT
27 realcur="${cur##*,}"
28 prefix="${cur%$realcur}"
29 OUTPUT_ALL="FLAG DESCRIPTION STATUS BOOT-STATUS DEVICE"
30 for WORD in $OUTPUT_ALL; do
31 if ! [[ $prefix == *"$WORD"* ]]; then
32 OUTPUT="$WORD ${OUTPUT:-""}"
33 fi
34 done
35 compopt -o nospace
36 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
37 return 0
38 ;;
39 '-s'|'--settimeout')
40 COMPREPLY=( $(compgen -W "seconds" -- $cur) )
41 return 0
42 ;;
43 '-h'|'--help'|'-V'|'--version')
44 return 0
45 ;;
46 esac
47 case $cur in
48 -*)
49 OPTS="--flags
50 --noflags
51 --noident
52 --noheadings
53 --oneline
54 --output
55 --raw
56 --notimeouts
57 --settimeout
58 --flags-only
59 --help
60 --version"
61 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
62 return 0
63 ;;
64 esac
65 local IFS=$'\n'
66 compopt -o filenames
67 COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) )
68 return 0
69 }
70 complete -F _wdctl_module wdctl