su: Add linux-specific completion
This commit is contained in:
parent
071ba93a0b
commit
d2aedc83e1
@ -59,7 +59,7 @@ complete -d pushd
|
||||
# start of section containing compspecs that can be handled within bash
|
||||
|
||||
# user commands see only users
|
||||
complete -u su write chfn groups slay w sux runuser
|
||||
complete -u write chfn groups slay w sux runuser
|
||||
|
||||
# bg completes with stopped jobs
|
||||
complete -A stopped -P '"%' -S '"' bg
|
||||
|
@ -293,6 +293,7 @@ bashcomp_DATA = a2x \
|
||||
sshmitm \
|
||||
sshow \
|
||||
strace \
|
||||
su \
|
||||
sudo \
|
||||
svk \
|
||||
sync_members \
|
||||
|
35
completions/su
Normal file
35
completions/su
Normal file
@ -0,0 +1,35 @@
|
||||
# bash completion for su(1) -*- shell-script -*-
|
||||
|
||||
if [[ $OSTYPE != *linux* ]]; then
|
||||
complete -u su # default completion
|
||||
return
|
||||
fi
|
||||
|
||||
_su() # linux-specific completion
|
||||
{
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
case "$prev" in
|
||||
-s|--shell)
|
||||
_filedir
|
||||
return
|
||||
;;
|
||||
-c|--command)
|
||||
local IFS=$'\n'
|
||||
compopt -o filenames
|
||||
COMPREPLY=( $( compgen -d -c -- "$cur" ) )
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user