]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/wdctl
scriptlive: add new command to re-execute script(1) typescript
[thirdparty/util-linux.git] / bash-completion / wdctl
CommitLineData
c6f8c3f5
SK
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')
b5b80e5a
BE
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
abbcec4f 32 OUTPUT="$WORD ${OUTPUT:-""}"
b5b80e5a
BE
33 fi
34 done
c6f8c3f5 35 compopt -o nospace
b5b80e5a 36 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
c6f8c3f5
SK
37 return 0
38 ;;
39 '-s'|'--settimeout')
40 COMPREPLY=( $(compgen -W "seconds" -- $cur) )
41 return 0
42 ;;
d4f9b8d7
VS
43 '-h'|'--help'|'-V'|'--version')
44 return 0
45 ;;
c6f8c3f5
SK
46 esac
47 case $cur in
48 -*)
0d5b9b8a
VS
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"
c6f8c3f5
SK
61 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
62 return 0
63 ;;
64 esac
ce3e6b15 65 local IFS=$'\n'
c6f8c3f5
SK
66 compopt -o filenames
67 COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) )
68 return 0
69}
70complete -F _wdctl_module wdctl