]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/su
bash-completion: Don't offer any more completions after help or version.
[thirdparty/util-linux.git] / bash-completion / su
1 _su_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 '-'|'-u'|'--user')
9 COMPREPLY=( $(compgen -u -- $cur) )
10 return 0
11 ;;
12 '-g'|'--group'|'-G'|'--supp-group')
13 COMPREPLY=( $(compgen -g -- $cur) )
14 return 0
15 ;;
16 '-s'|'--shell')
17 COMPREPLY=( $(compgen -W "$(chsh -l)" -- $cur) )
18 return 0
19 ;;
20 '-h'|'--help'|'-V'|'--version')
21 return 0
22 ;;
23 esac
24 case $cur in
25 -*)
26 OPTS=" -
27 -u --user
28 -m -p --preserve-environment
29 -g --group
30 -G --supp-group
31 -l --login
32 -c --command
33 --session-command
34 -f --fast
35 -s --shell
36 -h --help
37 -V --version"
38 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
39 return 0
40 ;;
41 esac
42 compopt -o filenames
43 COMPREPLY=( $(compgen -f -- $cur) )
44 return 0
45 }
46 complete -F _su_module su
47 complete -F _su_module runuser