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