diff options
Diffstat (limited to 'composer-bash-completion')
-rw-r--r-- | composer-bash-completion | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/composer-bash-completion b/composer-bash-completion index dba4a5c..64aa6bb 100644 --- a/composer-bash-completion +++ b/composer-bash-completion @@ -11,20 +11,21 @@ _sf_composer() { local sf_cmd="${COMP_WORDS[0]}" # for an alias, get the real script behind it - if [[ $(type -t $sf_cmd) == "alias" ]]; then + sf_cmd_type=$(type -t $sf_cmd) + if [[ $sf_cmd_type == "alias" ]]; then sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/") - else + elif [[ $sf_cmd_type == "file" ]]; then sf_cmd=$(type -p $sf_cmd) fi - if [ ! -x "$sf_cmd" ]; then + if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then return 1 fi local cur prev words cword _get_comp_words_by_ref -n := cur prev words cword - local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S2.4.4") + local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S2.5.0") for w in ${words[@]}; do w=$(printf -- '%b' "$w") # remove quotes from typed values |