[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 11d4d978876ceb58eaec5dcfd82fae7b9699acfd
Ville Skyttä
ville.skytta at iki.fi
Fri Sep 4 20:59:50 UTC 2009
The following commit has been merged in the master branch:
commit 11d4d978876ceb58eaec5dcfd82fae7b9699acfd
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Fri Sep 4 23:59:34 2009 +0300
Improve sudo completion (Alioth: #311414).
diff --git a/CHANGES b/CHANGES
index 05d01be..163d047 100644
--- a/CHANGES
+++ b/CHANGES
@@ -105,6 +105,7 @@ bash-completion (1.x)
and zmore filename completions.
* Add xz and compress support and more tarball filename extensions to
rpmbuild -t*/--tarbuild completion.
+ * Improve sudo completion (Alioth: #311414).
[ Todd Zullinger ]
* Make yum complete on filenames after install, deplist, update and upgrade
diff --git a/Makefile.am b/Makefile.am
index d903632..e26f0a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -121,6 +121,7 @@ bashcomp_DATA = contrib/ant \
contrib/snownews \
contrib/ssh \
contrib/strace \
+ contrib/sudo \
contrib/svk \
contrib/sysctl \
contrib/sysv-rc \
diff --git a/bash_completion b/bash_completion
index 806dacf..022a7d1 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1387,7 +1387,7 @@ _root_command()
{
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()
{
diff --git a/contrib/ntpdate b/contrib/sudo
similarity index 52%
copy from contrib/ntpdate
copy to contrib/sudo
index f717f58..fd35932 100644
--- a/contrib/ntpdate
+++ b/contrib/sudo
@@ -1,10 +1,10 @@
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
# ex: ts=8 sw=8 noet filetype=sh
#
-# bash completion for ntpdate
+# bash completion for sudo
-have ntpdate &&
-_ntpdate()
+have sudo &&
+_sudo()
{
local cur prev
@@ -12,22 +12,24 @@ _ntpdate()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ # TODO: more option completions
+
case $prev in
- -k)
+ -e)
_filedir
return 0
;;
- -U)
- COMPREPLY=( $( compgen -u $cur ) )
+ -u)
+ COMPREPLY=( $( compgen -u -- $cur ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
- -e -k -p -o -r -t' -- $cur ) )
- else
- _known_hosts_real "$cur"
+ COMPREPLY=( $( compgen -W '-e -u' -- $cur ) )
+ return 0
fi
+
+ _root_command $1 $2 $3
} &&
-complete -F _ntpdate ntpdate
+complete -F _sudo $filenames sudo
--
bash-completion
More information about the Bash-completion-commits
mailing list