Improve sudo completion (Alioth: #311414).
This commit is contained in:
parent
8770727a08
commit
11d4d97887
1
CHANGES
1
CHANGES
@ -105,6 +105,7 @@ bash-completion (1.x)
|
|||||||
and zmore filename completions.
|
and zmore filename completions.
|
||||||
* Add xz and compress support and more tarball filename extensions to
|
* Add xz and compress support and more tarball filename extensions to
|
||||||
rpmbuild -t*/--tarbuild completion.
|
rpmbuild -t*/--tarbuild completion.
|
||||||
|
* Improve sudo completion (Alioth: #311414).
|
||||||
|
|
||||||
[ Todd Zullinger ]
|
[ Todd Zullinger ]
|
||||||
* Make yum complete on filenames after install, deplist, update and upgrade
|
* Make yum complete on filenames after install, deplist, update and upgrade
|
||||||
|
@ -121,6 +121,7 @@ bashcomp_DATA = contrib/ant \
|
|||||||
contrib/snownews \
|
contrib/snownews \
|
||||||
contrib/ssh \
|
contrib/ssh \
|
||||||
contrib/strace \
|
contrib/strace \
|
||||||
|
contrib/sudo \
|
||||||
contrib/svk \
|
contrib/svk \
|
||||||
contrib/sysctl \
|
contrib/sysctl \
|
||||||
contrib/sysv-rc \
|
contrib/sysv-rc \
|
||||||
|
@ -1387,7 +1387,7 @@ _root_command()
|
|||||||
{
|
{
|
||||||
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
|
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3
|
||||||
}
|
}
|
||||||
complete -F _root_command $filenames sudo fakeroot really gksudo gksu kdesudo
|
complete -F _root_command $filenames fakeroot really gksudo gksu kdesudo
|
||||||
|
|
||||||
_longopt()
|
_longopt()
|
||||||
{
|
{
|
||||||
|
35
contrib/sudo
Normal file
35
contrib/sudo
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
|
||||||
|
# ex: ts=8 sw=8 noet filetype=sh
|
||||||
|
#
|
||||||
|
# bash completion for sudo
|
||||||
|
|
||||||
|
have sudo &&
|
||||||
|
_sudo()
|
||||||
|
{
|
||||||
|
local cur prev
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
cur=`_get_cword`
|
||||||
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
|
# TODO: more option completions
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
-e)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-u)
|
||||||
|
COMPREPLY=( $( compgen -u -- $cur ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W '-e -u' -- $cur ) )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
_root_command $1 $2 $3
|
||||||
|
} &&
|
||||||
|
complete -F _sudo $filenames sudo
|
Loading…
x
Reference in New Issue
Block a user