]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/su
su: use lib/pty-session.c code for --pty
[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=" --user
27 --preserve-environment
28 --whitelist-environment
29 --group
30 --supp-group
31 --login
32 --command
33 --session-command
34 --fast
35 --shell
36 --help
37 --version"
38 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
39 return 0
40 ;;
41 esac
42 local IFS=$'\n'
43 compopt -o filenames
44 COMPREPLY=( $(compgen -f -- $cur) )
45 return 0
46 }
47 complete -F _su_module su
48 complete -F _su_module runuser