]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/sfdisk
su: use lib/pty-session.c code for --pty
[thirdparty/util-linux.git] / bash-completion / sfdisk
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
8 '-d'|'--dump'|'-J'|'--json'|'-l'|'--list'|'-F'|'--list-free'|'-r'|'--reorder'|'-s'|'--show-size'|'-V'|'--verify'|'-A'|'--activate'|'--delete')
9 compopt -o bashdefault -o default
10 COMPREPLY=( $(compgen -W "$(lsblk -dpnro name)" -- $cur) )
11 return 0
12 ;;
13 '-N'|'--partno')
14 COMPREPLY=( $(compgen -W "number" -- $cur) )
15 return 0
16 ;;
17 '--color'|'-w'|'--wipe'|'-W'|'--wipe-partitions')
18 COMPREPLY=( $(compgen -W "auto never always" -- $cur) )
19 return 0
20 ;;
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
32 OUTPUT="$WORD ${OUTPUT:-""}"
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')
40 local IFS=$'\n'
41 compopt -o filenames
42 COMPREPLY=( $(compgen -f -- $cur) )
43 return 0
44 ;;
45 '-h'|'--help'|'-v'|'--version')
46 return 0
47 ;;
48 esac
49 case $cur in
50 '=')
51 cur=${cur#=}
52 ;;
53 -*)
54 OPTS="
55 --activate
56 --dump
57 --json
58 --show-geometry
59 --list
60 --list-free
61 --reorder
62 --show-size
63 --list-types
64 --verify
65 --delete
66 --part-label
67 --part-type
68 --part-uuid
69 --part-attrs
70 --append
71 --backup
72 --bytes
73 --move-data
74 --force
75 --color
76 --partno
77 --no-act
78 --no-reread
79 --no-tell-kernel
80 --backup-file
81 --output
82 --quiet
83 --wipe
84 --wipe-partitions
85 --label
86 --label-nested
87 --help
88 --version
89 "
90 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
91 return 0
92 ;;
93 esac
94 compopt -o bashdefault -o default
95 COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
96 return 0
97 }
98 complete -F _sfdisk_module sfdisk