diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2011-10-23 11:32:13 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-10-23 11:32:13 +0300 |
commit | 8fe4a73f9a487db2ec931d1d1e1e4f674a616d4a (patch) | |
tree | fc09d0cc22db04c3aac342e54247297b0afa660b | |
parent | f6cd9344fb33642763579db12faa5d757c27d69b (diff) | |
download | bash-completion-8fe4a73f9a487db2ec931d1d1e1e4f674a616d4a.tar.gz |
_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.
-rw-r--r-- | bash_completion | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bash_completion b/bash_completion index 7aa16c6e..8b6cdb4f 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 |