[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-114-ga0afe09
Ville Skyttä
ville.skytta at iki.fi
Sun Apr 24 17:23:45 UTC 2011
The following commit has been merged in the master branch:
commit a0afe0959bf322e894cda25c8d409b2451a8dd7a
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Sun Apr 24 20:14:48 2011 +0300
Try to figure out file/dir argument types from --foo=BAR in _longopt().
diff --git a/bash_completion b/bash_completion
index e550af8..f1def50 100644
--- a/bash_completion
+++ b/bash_completion
@@ -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
--
bash-completion
More information about the Bash-completion-commits
mailing list