Debian Codegraph @

bash-completion/sfdisk

raw
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 "$(command 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 --discard-free
62 --disk-id
63 --reorder
64 --show-size
65 --list-types
66 --verify
67 --relocate
68 --delete
69 --part-label
70 --part-type
71 --part-uuid
72 --part-attrs
73 --append
74 --backup
75 --backup-pt-sectors
76 --bytes
77 --move-data
78 --force
79 --color
80 --lock
81 --partno
82 --no-act
83 --no-reread
84 --no-tell-kernel
85 --backup-file
86 --output
87 --quiet
88 --wipe
89 --wipe-partitions
90 --label
91 --label-nested
92 --Linux
93 --move-use-fsync
94 --sector-size
95 --show-pt-geometry
96 --unit
97 --help
98 --version
99 "
100 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
101 return 0
102 ;;
103 esac
104 compopt -o bashdefault -o default
105 COMPREPLY=( $(compgen -W "$(command lsblk -pnro name)" -- $cur) )
106 return 0
107 }
108 complete -F _sfdisk_module sfdisk