]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/su
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / su
CommitLineData
41e5a92c
SK
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 ;;
d4f9b8d7
VS
20 '-h'|'--help'|'-V'|'--version')
21 return 0
22 ;;
41e5a92c
SK
23 esac
24 case $cur in
25 -*)
0d5b9b8a
VS
26 OPTS=" --user
27 --preserve-environment
5feae697 28 --whitelist-environment
0d5b9b8a
VS
29 --group
30 --supp-group
31 --login
32 --command
41e5a92c 33 --session-command
0d5b9b8a
VS
34 --fast
35 --shell
36 --help
37 --version"
41e5a92c
SK
38 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
39 return 0
40 ;;
41 esac
ce3e6b15 42 local IFS=$'\n'
41e5a92c
SK
43 compopt -o filenames
44 COMPREPLY=( $(compgen -f -- $cur) )
45 return 0
46}
47complete -F _su_module su
48complete -F _su_module runuser