]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/wipefs
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / wipefs
1 _wipefs_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 '-O'|'--output')
9 local prefix realcur OUTPUT_ALL OUTPUT
10 realcur="${cur##*,}"
11 prefix="${cur%$realcur}"
12 OUTPUT_ALL="UUID LABEL LENGTH TYPE OFFSET USAGE DEVICE"
13 for WORD in $OUTPUT_ALL; do
14 if ! [[ $prefix == *"$WORD"* ]]; then
15 OUTPUT="$WORD ${OUTPUT:-""}"
16 fi
17 done
18 compopt -o nospace
19 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
20 return 0
21 ;;
22 '-o'|'--offset')
23 COMPREPLY=( $(compgen -W "offset" -- $cur) )
24 return 0
25 ;;
26 '-t'|'--types')
27 local TYPES
28 TYPES="$(blkid -k)"
29 COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
30 return 0
31 ;;
32 '-h'|'--help'|'-V'|'--version')
33 return 0
34 ;;
35 esac
36 case $cur in
37 -*)
38 OPTS="
39 --all
40 --backup
41 --force
42 --noheadings
43 --json
44 --no-act
45 --offset
46 --output
47 --parsable
48 --quiet
49 --types
50 --help
51 --version
52 "
53 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
54 return 0
55 ;;
56 esac
57 COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
58 return 0
59 }
60 complete -F _wipefs_module wipefs