Last active
May 10, 2023 02:52
-
-
Save henriquemoody/5014805 to your computer and use it in GitHub Desktop.
PHPUnit Bash Completion. sudo curl -L https://gist.githubusercontent.com/henriquemoody/5014805/raw/phpunit.bash -o /etc/bash_completion.d/phpunit && source /etc/bash_completion.d/phpunit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash-Completion script for PHPUnit | |
# | |
# Created by Henrique Moody <[email protected]> | |
# | |
_phpunit() | |
{ | |
COMPREPLY=() | |
local cur="${COMP_WORDS[COMP_CWORD]}" | |
local prev="${COMP_WORDS[COMP_CWORD-1]}" | |
local opts="--coverage-clover --coverage-crap4j --coverage-html --coverage-php --coverage-text --coverage-xml --log-junit --log-tap --log-json --testdox-html --testdox-text --filter --testsuite --group --exclude-group --list-groups --test-suffix --report-useless-tests --strict-coverage --disallow-test-output --enforce-time-limit --disallow-todo-tests --process-isolation --no-globals-backup --static-backup --colors --columns --columns --stderr --stop-on-error --stop-on-failure --stop-on-risky --stop-on-skipped --stop-on-incomplete -v --verbose --debug --loader --repeat --tap --testdox --printer --bootstrap -c --configuration --no-configuration --include-path -d -h --help --version" | |
local diropts="--coverage-html|--coverage-xml|--include-path" | |
local nocompleteopts="--filter|--testsuite|--group|--exclude-group|--test-suffix|--loader|--repeat|--printer|-d|-h|--help|--version" | |
if [[ ${prev} =~ ${diropts} ]]; then | |
COMPREPLY=( $(compgen -d -- ${cur}) ) | |
return 0 | |
elif [[ ${prev} =~ ${nocompleteopts} ]]; then | |
return 0 | |
elif [[ ${prev} = --columns ]]; then | |
COMPREPLY=( $(compgen -W "max" -- ${cur}) ) | |
return 0 | |
elif [[ ${prev} = --colors ]]; then | |
COMPREPLY=( $(compgen -W "auto never always" -- ${cur}) ) | |
return 0 | |
elif [[ "${cur}" == -* ]]; then | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
else | |
COMPREPLY=( $(compgen -f -- "${cur}") ) | |
return 0 | |
fi | |
} | |
complete -F _phpunit phpunit |
Thanks, @drgomesp.
I just tested on Fedora 17, I guess it works on other systems.
I test on Ubuntu 12.04 and fully work.
Great job man!
Thanks, @hussani =)
Link in description leads to error page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great!