bash-completion/FOO-dir-completion-boo905348.patch

22 lines
560 B
Diff

---
bash_completion | 8 ++++++++
1 file changed, 8 insertions(+)
--- bash_completion
+++ bash_completion 2014-11-17 12:41:17.573518527 +0000
@@ -565,6 +565,14 @@ _filedir()
local -a toks
local quoted x tmp
+ if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)/ ]]; then
+ eval local dir="${cur%%/*}"
+ if [[ -d "$dir" ]]; then
+ cur="${dir}/${cur#*/}"
+ [[ "$1" != -d ]] && set -- -d $@
+ fi
+ fi
+
_quote_readline_by_ref "$cur" quoted
x=$( compgen -d -- "$quoted" ) &&
while read -r tmp; do