]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/chsh
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / chsh
1 _chsh_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 '-s'|'--shell')
9 COMPREPLY=( $(compgen -W "$($1 -l)" -- $cur) )
10 return 0
11 ;;
12 '-u'|'--help'|'-v'|'--version')
13 return 0
14 ;;
15 esac
16 case $cur in
17 -*)
18 OPTS="--shell --list-shells --version --help"
19 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
20 return 0
21 ;;
22 esac
23 COMPREPLY=( $(compgen -u -- $cur) )
24 return 0
25 }
26 complete -F _chsh_module chsh