[Bash-completion-commits] [SCM] bash-completion branch, master, updated. ec82c536ed22d5a79eb6d06675fb9f634943fb1f

Ville Skyttä ville.skytta at iki.fi
Sun Oct 31 19:48:38 UTC 2010


The following commit has been merged in the master branch:
commit 9093ae293b006614ac6eb7bb32d60c5df74543d2
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Oct 31 20:26:32 2010 +0200

    Expose root command name from _root_command, add _complete_as_root helper.

diff --git a/bash_completion b/bash_completion
index 3b477cd..de37fc9 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1489,10 +1489,17 @@ complete -F _command -o filenames aoss command do else eval exec ltrace nice \
 _root_command()
 {
     local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
+    local root_command=$1
     _command $1 $2 $3
 }
 complete -F _root_command -o filenames fakeroot gksu gksudo kdesudo really sudo
 
+# Return true if the completion should be treated as running as root
+_complete_as_root()
+{
+    [[ $EUID -eq 0 || ${root_command:-} ]]
+}
+
 _longopt()
 {
     local cur prev split=false

-- 
bash-completion



More information about the Bash-completion-commits mailing list