forked from shengyou/codeception-zsh-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codeception.plugin.zsh
43 lines (37 loc) · 1007 Bytes
/
codeception.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Codeception command completion
# Functions
_codeception_get_command_list () {
vendor/bin/codecept --no-ansi \
| sed "1,/Available commands/d" \
| awk '/^ [a-z]+/ { print $1 }'
}
_codeception () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->commands'\
'2: :->args'\
'*: :->opts'
if [ -f vendor/bin/codecept ]; then
case $state in
commands)
compadd `_codeception_get_command_list`
;;
args)
case $words[2] in
generate:cept|generate:cest|generate:pageobject|generate:phpunit|generate:scenarios|generate:stepobject|generate:suite|generate:test)
compadd functional acceptance unit
;;
esac
;;
*)
compadd `vendor/bin/codecept $words[2] -h --no-ansi | sed "1,/Options:/d" | sed '/^$/d' | awk '{ print $1 }'`
;;
esac
fi
}
# Completion setup
compdef _codeception vendor/bin/codecept
compdef _codeception codecept
# Alias
alias codecept='vendor/bin/codecept'