Skip to content

Commit

Permalink
Merge pull request bramus#8 from mundry/complete-run-script-arguments
Browse files Browse the repository at this point in the history
Complete arguments along with scripts for run-script.
  • Loading branch information
bramus authored Oct 17, 2019
2 parents 4a6d2b2 + 4d81003 commit 88829ec
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions composer-autocomplete
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@ function _composer_scripts() {
fi
done

#
# Complete scripts for composer "run-script" command.
#
if [ "$subcmd" == "run-script" ] ; then
local scripts=$("$cmd" --no-ansi 2> /dev/null | grep 'script as defined in composer.json' | awk '/^ +[a-z]+/ { print $1 }')
COMPREPLY=( $(compgen -W "${scripts}" -- ${cur}) )
return 0
fi

#
# Complete the arguments to some of the commands.
#
if [ "$subcmd" != "${COMP_WORDS[0]}" ] ; then
local opts=$("$cmd" "$subcmd" -h --no-ansi 2> /dev/null | tr -cs '[=-=][:alpha:]_' '[\n*]' | grep '^-')
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
# Complete scripts for composer "run-script" command.
if [ "$subcmd" == "run-script" ] ; then
local scripts=$("$cmd" --no-ansi 2> /dev/null | grep 'script as defined in composer.json' | awk '/^ +[a-z]+/ { print $1 }')
fi
COMPREPLY=( $(compgen -W "${opts} ${scripts}" -- ${cur}) )
return 0
fi

Expand Down

0 comments on commit 88829ec

Please # to comment.