Try to figure out file/dir argument types from --foo=BAR in _longopt().

This commit is contained in:
Ville Skyttä 2011-04-24 20:14:48 +03:00
parent e104424ff2
commit a0afe0959b

View File

@ -1619,6 +1619,21 @@ _longopt()
_filedir
return 0
;;
--+([-a-z0-9_]))
local argtype=$( $1 --help 2>&1 | \
sed -ne "s|.*$prev\[\?=[<[]\?\([-A-Za-z0-9_]\{1,\}\).*|\1|p" )
case ${argtype,,} in
*dir*)
compopt +o default
_filedir -d
return 0
;;
*file*|*path*)
_filedir
return 0
;;
esac
;;
esac
$split && return 0