38 lines
881 B
Plaintext
Raw Normal View History

2012-02-06 19:09:51 +04:00
# bash completion for su(1) -*- shell-script -*-
if [[ $OSTYPE != *linux* ]]; then
complete -u su # default completion
return
fi
_su() # linux-specific completion
{
2012-02-18 10:12:02 +02:00
local cur prev words cword split
_init_completion -s || return
2012-02-06 19:09:51 +04:00
case "$prev" in
-s|--shell)
_shells
2012-02-06 19:09:51 +04:00
return
;;
-c|--command|--session-command)
2012-02-06 19:09:51 +04:00
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $( compgen -d -c -- "$cur" ) )
return
;;
esac
2012-02-18 10:12:02 +02:00
$split && return
2012-02-06 19:09:51 +04:00
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi
COMPREPLY=( $( compgen -u -- "$cur" ) )
} && complete -F _su su
# ex: ts=4 sw=4 et filetype=sh