]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/swapon
bash-completion: Don't offer any more completions after help or version.
[thirdparty/util-linux.git] / bash-completion / swapon
1 _swapon_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 '-p'|'--priority')
9 # Priority range is -1 to 32767. Perhaps these
10 # few are enough.
11 COMPREPLY=( $(compgen -W "$(echo {-1..9} 32767)" -- $cur) )
12 return 0
13 ;;
14 '--show')
15 # FIXME: how to append to a string with compgen?
16 local OUTPUT
17 OUTPUT="NAME TYPE SIZE USED PRIO"
18 compopt -o nospace
19 COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
20 return 0
21 ;;
22 '-h'|'--help'|'-V'|'--version')
23 return 0
24 ;;
25 esac
26 case $cur in
27 -*)
28 OPTS="-a --all
29 -d --discard
30 -e --ifexists
31 -f --fixpgsz
32 -p --priority
33 -s --summary
34 --show
35 --noheadings
36 --raw
37 --bytes
38 -v --verbose
39 -h --help
40 -V --version"
41 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
42 return 0
43 ;;
44 esac
45 # FIXME: compgen will split SPEC= from '=' point. The append
46 # comma separated value problem is very similar.
47 compopt -o filenames
48 COMPREPLY=( $(compgen -f -- $cur) )
49 return 0
50 }
51 complete -F _swapon_module swapon