Improve _longopt --*=, --*dir*, --*file*, and --*path* completions.

This commit is contained in:
Ville Skyttä 2010-10-23 14:27:15 +03:00
parent 768bbc7858
commit d51ad46cd2

View File

@ -1485,21 +1485,23 @@ complete -F _root_command -o filenames sudo fakeroot really gksudo gksu kdesudo
_longopt()
{
local cur prev
local cur prev split=false
_get_comp_words_by_ref -n = cur prev
_get_comp_words_by_ref cur prev
_split_longopt && split=true
if _split_longopt; then
case "$prev" in
--*[Dd][Ii][Rr]*)
_filedir -d
return 0
;;
--*[Ff][Ii][Ll][Ee]*|--*[Pp][Aa][Tt][Hh]*)
_filedir
return 0
;;
esac
return 0
fi
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \