]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/wipefs
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / wipefs
CommitLineData
76dceb10
SK
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
37a6cc7a
SK
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 ;;
76dceb10
SK
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 ;;
d4f9b8d7
VS
32 '-h'|'--help'|'-V'|'--version')
33 return 0
34 ;;
76dceb10
SK
35 esac
36 case $cur in
37 -*)
c6b1d511
SK
38 OPTS="
39 --all
40 --backup
41 --force
37a6cc7a
SK
42 --noheadings
43 --json
c6b1d511
SK
44 --no-act
45 --offset
37a6cc7a 46 --output
c6b1d511
SK
47 --parsable
48 --quiet
49 --types
37a6cc7a 50 --help
c6b1d511
SK
51 --version
52 "
76dceb10
SK
53 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
54 return 0
55 ;;
56 esac
53154dae 57 COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
76dceb10
SK
58 return 0
59}
60complete -F _wipefs_module wipefs