]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/fdisk
bash-completion: stop being clever when listing block devices
[thirdparty/util-linux.git] / bash-completion / fdisk
CommitLineData
2bd3b27a
SK
1_fdisk_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
675821f4 8 '-s'|'--getsz')
53154dae 9 COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
2bd3b27a
SK
10 return 0
11 ;;
675821f4 12 '-b'|'--sector-size')
2bd3b27a
SK
13 COMPREPLY=( $(compgen -W "512 1024 2048 4096" -- $cur) )
14 return 0
15 ;;
675821f4 16 '-c'|'--compatibility')
2bd3b27a
SK
17 COMPREPLY=( $(compgen -W "dos nondos" -- $cur) )
18 return 0
19 ;;
675821f4
KZ
20 '-L'|'--color')
21 COMPREPLY=( $(compgen -W "auto never always" -- $cur) )
22 return 0
23 ;;
24 '-u'|'--units')
2bd3b27a
SK
25 COMPREPLY=( $(compgen -W "cylinders sectors" -- $cur) )
26 return 0
27 ;;
675821f4 28 '-C'|'--geom-cylinders'|'-H'|'--geom-heads'|'-S'|'--geom-sectors')
2bd3b27a
SK
29 COMPREPLY=( $(compgen -W "number" -- $cur) )
30 return 0
31 ;;
675821f4 32 '-h'|'--help'|'-v'|'--version'|'-V'|'--list')
d4f9b8d7
VS
33 return 0
34 ;;
2bd3b27a
SK
35 esac
36 case $cur in
37 -*)
675821f4
KZ
38 OPTS="--sector-size
39 --compatibility
40 --color
41 --list
42 --type
43 --units
44 --getsz
45 --geom-cylinders
46 --geom-heads
47 --geom-sectors
48 --help
49 --version"
2bd3b27a
SK
50 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
51 return 0
52 ;;
53 esac
53154dae 54 COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
2bd3b27a
SK
55 return 0
56}
57complete -F _fdisk_module fdisk