diff options
author | Remi Collet <remi@remirepo.net> | 2022-12-20 13:45:31 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2022-12-20 13:45:31 +0100 |
commit | 09ade9d89a9f0e1c917683f8ed8590be46793470 (patch) | |
tree | 45c4c1fe822aa9bb5b19caa71c722f96475a31e3 /composer-bash-completion | |
parent | ab250273e212c69343f3a4199b3b8c44be40d24b (diff) |
update to 2.5.0
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 |