]>
Commit | Line | Data |
---|---|---|
bf60993c SK |
1 | _delpart_module() |
2 | { | |
3 | local cur prev OPTS | |
4 | COMPREPLY=() | |
5 | cur="${COMP_WORDS[COMP_CWORD]}" | |
6 | prev="${COMP_WORDS[COMP_CWORD-1]}" | |
d4f9b8d7 VS |
7 | case $prev in |
8 | '-h'|'--help'|'-V'|'--version') | |
9 | return 0 | |
10 | ;; | |
11 | esac | |
bf60993c SK |
12 | case $COMP_CWORD in |
13 | 1) | |
53154dae | 14 | OPTS="--help --version $(lsblk -pnro name)" |
bf60993c SK |
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 | esac | |
22 | return 0 | |
23 | } | |
24 | complete -F _delpart_module delpart |