]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/sfdisk
fstrim: ignore non-directory mountpoints
[thirdparty/util-linux.git] / bash-completion / sfdisk
CommitLineData
2bd3b27a
SK
1_sfdisk_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
99d8ed0a
SK
8 '-d'|'--dump'|'-J'|'--json'|'-l'|'--list'|'-F'|'--list-free'|'-r'|'--reorder'|'-s'|'--show-size'|'-V'|'--verify'|'-A'|'--activate'|'--delete')
9 COMPREPLY=( $(compgen -W "$(lsblk -dpnro name)" -- $cur) )
10 return 0
11 ;;
12 '-N'|'--partno')
2bd3b27a
SK
13 COMPREPLY=( $(compgen -W "number" -- $cur) )
14 return 0
15 ;;
99d8ed0a 16 '--color'|'-w'|'--wipe'|'-W'|'--wipe-partitions')
24bdce6e
SK
17 COMPREPLY=( $(compgen -W "auto never always" -- $cur) )
18 return 0
19 ;;
99d8ed0a
SK
20 '-o'|'--output')
21 local prefix realcur OUTPUT_ALL OUTPUT
22 realcur="${cur##*,}"
23 prefix="${cur%$realcur}"
24 OUTPUT_ALL="
25 Attrs Boot Bsize Cpg Cylinders Device End
26 End-C/H/S Flags Fsize Id Name Sectors Size
27 Slice Start Start-C/H/S Type Type-UUID UUID
28 "
29 for WORD in $OUTPUT_ALL; do
30 if ! [[ $prefix == *"$WORD"* ]]; then
abbcec4f 31 OUTPUT="$WORD ${OUTPUT:-""}"
99d8ed0a
SK
32 fi
33 done
34 compopt -o nospace
35 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") )
36 return 0
37 ;;
38 '-O'|'--backup-file')
ce3e6b15 39 local IFS=$'\n'
2bd3b27a
SK
40 compopt -o filenames
41 COMPREPLY=( $(compgen -f -- $cur) )
42 return 0
d4f9b8d7
VS
43 ;;
44 '-h'|'--help'|'-v'|'--version')
45 return 0
2bd3b27a
SK
46 ;;
47 esac
48 case $cur in
49 '=')
50 cur=${cur#=}
51 ;;
52 -*)
24bdce6e
SK
53 OPTS="
54 --activate
55 --dump
56 --json
57 --show-geometry
0d5b9b8a 58 --list
8abdb912 59 --list-free
99d8ed0a 60 --reorder
24bdce6e 61 --show-size
0d5b9b8a 62 --list-types
0d5b9b8a 63 --verify
99d8ed0a 64 --delete
24bdce6e
SK
65 --part-label
66 --part-type
67 --part-uuid
68 --part-attrs
69 --append
70 --backup
71 --bytes
99d8ed0a 72 --move-data
0d5b9b8a 73 --force
24bdce6e
SK
74 --color
75 --partno
76 --no-act
2bd3b27a 77 --no-reread
99d8ed0a 78 --no-tell-kernel
24bdce6e
SK
79 --backup-file
80 --output
0d5b9b8a 81 --quiet
99d8ed0a
SK
82 --wipe
83 --wipe-partitions
24bdce6e
SK
84 --label
85 --label-nested
86 --help
87 --version
88 "
2bd3b27a
SK
89 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
90 return 0
91 ;;
92 esac
53154dae 93 COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
2bd3b27a
SK
94 return 0
95}
96complete -F _sfdisk_module sfdisk