[Bash-completion-commits] [SCM] bash-completion branch, dynamic-loading, updated. 1.3-472-g8fe4a73

Ville Skyttä ville.skytta at iki.fi
Sun Oct 23 08:33:39 UTC 2011


The following commit has been merged in the dynamic-loading branch:
commit 8fe4a73f9a487db2ec931d1d1e1e4f674a616d4a
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Oct 23 11:32:13 2011 +0300

    _completion_loader: Use _minimal instead of _longopt as fallback.
    
    _longopt may end up invoking the completed command with --help which
    may not be safe for all arbitrary commands out there.

diff --git a/bash_completion b/bash_completion
index 7aa16c6..8b6cdb4 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1817,6 +1817,15 @@ _install_xspec '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath
 _install_xspec '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)' kid3 kid3-qt
 unset -f _install_xspec
 
+# Minimal completion to use as fallback in _completion_loader.
+_minimal()
+{
+    local cur prev words cword split
+    _init_completion -s || return
+    $split && return
+    _filedir
+}
+
 # set up dynamic completion loading
 _completion_loader()
 {
@@ -1837,7 +1846,7 @@ _completion_loader()
     . "$compdir/${1##*/}" &>/dev/null && return 124
 
     # Need to define *something*, otherwise there will be no completion at all.
-    complete -F _longopt "$1" && return 124
+    complete -F _minimal "$1" && return 124
 } &&
 complete -D -F _completion_loader
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list