aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Nicoulaud <julien.nicoulaud@gmail.com>2018-10-24 20:32:16 +0200
committerJulien Nicoulaud <julien.nicoulaud@gmail.com>2018-10-24 20:32:56 +0200
commit8ec8c8c5c662c3cb77231b7458ce1975d2f8c967 (patch)
tree407ad0f12d8469f361ae7001ecc0389c14f2dd1a
parentMerge pull request #600 from pseyfert/golang (diff)
downloadzsh-completions-8ec8c8c5c662c3cb77231b7458ce1975d2f8c967.tar
zsh-completions-8ec8c8c5c662c3cb77231b7458ce1975d2f8c967.tar.gz
zsh-completions-8ec8c8c5c662c3cb77231b7458ce1975d2f8c967.tar.bz2
zsh-completions-8ec8c8c5c662c3cb77231b7458ce1975d2f8c967.tar.lz
zsh-completions-8ec8c8c5c662c3cb77231b7458ce1975d2f8c967.tar.xz
zsh-completions-8ec8c8c5c662c3cb77231b7458ce1975d2f8c967.tar.zst
zsh-completions-8ec8c8c5c662c3cb77231b7458ce1975d2f8c967.zip
tox: fix function not defined first time completion is called + simplify it0.29.0
-rw-r--r--src/_tox22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/_tox b/src/_tox
index 4982e99..efd0549 100644
--- a/src/_tox
+++ b/src/_tox
@@ -14,6 +14,16 @@
# ------------------------------------------------------------------------------
+(( $+functions[_tox_envs_list] )) ||
+_tox_envs_list() {
+ local envs; envs=($(_call_program envs $service --listenvs-all))
+ if [ ${#envs} -gt 0 ]; then
+ _values -s , 'tox environments' "${envs[@]}"
+ else
+ _message 'tox environments (none found)'
+ fi
+}
+
_arguments \
'(- 1 *)--version[show version and exit]' \
'(- 1 *)'{-h,--help}'[show help options]' \
@@ -42,18 +52,6 @@ _arguments \
'--workdir[tox working directory]: :_files -/' \
'*: :_guard "^-*" command positional substitution arguments'
-(( $+functions[_tox_envs_list] )) ||
-_tox_envs_list() {
- compset -P '*,'; compset -S ',*'
- _wanted env-list expl 'tox env list' _tox_envs -qS,
-}
-
-(( $+functions[_tox_envs] )) ||
-_tox_envs() {
- local envs; envs=($(_call_program envs $service --listenvs-all))
- _describe -t envs 'tow env' envs "$@"
-}
-
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2