]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/partx
su: use lib/pty-session.c code for --pty
[thirdparty/util-linux.git] / bash-completion / partx
1 _partx_module()
2 {
3 local cur prev OPTS OUTPUT_ALL
4 COMPREPLY=()
5 OUTPUT_ALL="NR START END SECTORS SIZE NAME UUID TYPE FLAGS SCHEME"
6 cur="${COMP_WORDS[COMP_CWORD]}"
7 prev="${COMP_WORDS[COMP_CWORD-1]}"
8 case $prev in
9 '-n'|'--nr')
10 return 0
11 ;;
12 '-o'|'--output')
13 local realcur prefix OUTPUT
14 realcur="${cur##*,}"
15 prefix="${cur%$realcur}"
16 for WORD in $OUTPUT_ALL; do
17 if ! [[ $prefix == *"$WORD"* ]]; then
18 OUTPUT="$WORD ${OUTPUT:-""}"
19 fi
20 done
21 compopt -o nospace
22 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
23 return 0
24 ;;
25 '-S'|'--sector-size')
26 COMPREPLY=( $(compgen -W "size" -- $cur) )
27 return 0
28 ;;
29 '-t'|'--type')
30 COMPREPLY=( $(compgen -W "$(partx --list-types)" -- $cur) )
31 return 0
32 ;;
33 '-h'|'--help'|'-V'|'--version')
34 return 0
35 ;;
36 esac
37 case $cur in
38 -*)
39 OPTS="
40 --add
41 --delete
42 --update
43 --show
44 --bytes
45 --noheadings
46 --nr
47 --output
48 --output-all
49 --pairs
50 --raw
51 --sector-size
52 --type
53 --list-types
54 --verbose
55 --help
56 --version
57 "
58 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
59 return 0
60 ;;
61 esac
62 compopt -o bashdefault -o default
63 COMPREPLY=( $(compgen -W "$(lsblk -pnro name)" -- $cur) )
64 return 0
65 }
66 complete -F _partx_module partx