]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/resizepart
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / resizepart
1 _resizepart_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 '-h'|'--help'|'-V'|'--version')
9 return 0
10 ;;
11 esac
12 case $COMP_CWORD in
13 1)
14 OPTS="--help --version $(lsblk -pnro name)"
15 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
16 ;;
17 2)
18 prev="${COMP_WORDS[COMP_CWORD-1]}"
19 COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) )
20 ;;
21 3)
22 COMPREPLY="length"
23 ;;
24 esac
25 return 0
26 }
27 complete -F _resizepart_module resizepart