From ad2eaa9ea1af535645336bc6506e03b5744349b8 Mon Sep 17 00:00:00 2001 From: Jonathan MERCIER Date: Fri, 12 Aug 2011 11:30:05 +0200 Subject: [PATCH] enhance autocompletion --- bash_completion.d/ldc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bash_completion.d/ldc b/bash_completion.d/ldc index 261abd35..378156de 100644 --- a/bash_completion.d/ldc +++ b/bash_completion.d/ldc @@ -25,11 +25,14 @@ _ldc() -regalloc -rel -rewriter -run= -shrink-wrap -singleobj -soft-float -spiller -st \ -stack-protector-buffer-size= -stats -tailcallopt -time-passes -unittest -unwind-tables -v \ " - if [[ ${opts_with_path} =~ ${prev} ]] ; then - COMPREPLY=( $(compgen -f ${cur}) ) + if [[ "${opts_with_path}" = *"${prev}${cur}"* ]]; then + COMPREPLY=( $(compgen -f ./ ) ) return 0 - elif [[ ${cur} == -* ]] ; then - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + elif [[ "${opts_with_path}" = *"${prev}"* ]]; then + COMPREPLY=( $(compgen -f "${cur}") ) + return 0 + elif [[ "${cur}" == -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi }