zsh-completions/src/_tox

167 lines
6.5 KiB
Bash

#compdef tox
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for tox 4.32.0 (https://tox.readthedocs.io).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
_tox() {
typeset -A opt_args
local context state line
local curcontext="$curcontext"
local ret=1
local -a stderr_colors=(
BLACK BLUE CYAN GREEN LIGHTBLACK_EX LIGHTBLUE_EX LIGHTCYAN_EX LIGHTGREEN_EX LIGHTMAGENTA_EX
LIGHTRED_EX LIGHTWHITE_EX LIGHTYELLOW_EX MAGENTA RED RESET WHITE YELLOW
)
local -a options=(
'(- 1 *)'{-h,--help}'[show help options]'
'--colored[should output be enriched with colors]: :(yes no)'
'--stderr-color[color for stderr output]:color:(($stderr_colors))'
'--exit-and-dump-after[dump tox threads after specified seconds and exit the app]:seconds'
'(-c --conf)'{-c,--conf}'[configuration file/folder for tox]:file_or_dir:_files'
'--workdir[tox working directory]:dir:_files -/'
'--root[project root directory]:dir:_files -/'
'--runner[the tox run engine to use]:runner:(virtualenv)'
'--no-provision[do not perform provision]:json:_files -g "*.json"'
'--no-recreate-provision[do not recreate provision tox environment]'
'(-r --recreate)'{-r,--recreate}'[recreate the tox environments]'
'--matrix-scope[emit a github matrix specifix to scope mentioned]:scope:(all galaxy sanity integration unit)'
'--gh-matrix[emit a github matrix]'
'--ansible[enable ansible testing]'
)
_arguments -C \
'(- 1 *)'{-h,--help}'[show help options]' \
'--colored[should output be enriched with colors]: :(yes no)' \
'--stderr-color[color for stderr output]:color:(($stderr_colors))' \
'--exit-and-dump-after[dump tox threads after specified seconds and exit the app]:seconds' \
'(-c --conf)'{-c,--conf}'[configuration file/folder for tox]:file_or_dir:_files' \
'--workdir[tox working directory]:dir:_files -/' \
'--root[project root directory]:dir:_files -/' \
'--runner[the tox run engine to use]:runner:(virtualenv)' \
'(- *)--version[show program and plugins version and exit]' \
'--no-provision[do not perform provision]:json:_files -g "*.json"' \
'--no-recreate-provision[do not recreate provision tox environment]' \
'(-r --recreate)'{-r,--recreate}'[recreate the tox environments]' \
'--matrix-scope[emit a github matrix specifix to scope mentioned]:scope:(all galaxy sanity integration unit)' \
'--gh-matrix[emit a github matrix]' \
'--ansible[enable ansible testing]' \
\*{-x,--override}'[configuration override(s)]:override' \
\*{-v,--verbose}'[increase verbosity]' \
\*{-q,--quiet}'[decrease verbosity]' \
'1: :_tox_commands' \
'*::arg:->args' \
&& ret=0
case "$state" in
(args)
case $words[1] in
(run|run-parallel|depends|exec|list|quickstart|schema|config|devenv)
options+=(
'--result-json[write a JSON file with detailed information]:file:_files'
'--hashseed[set PYTHONHASHSEED to the specified seed before running commands]:sed'
'--discover[for Python discovery first try these Python executables]:file:_files'
'(--list-dependencies --no-list-dependencies)--list-dependencies[list the dependencies installed during environment setup]'
'(--list-dependencies --no-list-dependencies)--no-list-dependencies[never list the dependencies]'
'--develop[install package in development mode]'
)
;|
(run|run-parallel|direnv)
options+=(
'-m[label to evaluate]:label'
'-f[factor to evaluate]:factor'
)
;|
(run|run-parallel|exec|devenv)
options+=(
'(-s --skip-missing-interpreters)'{-s,--skip-missing-interpreters}'[do not fail tests for missing interpreters]'
'(-n --notest)'{-n,--notest}'[do not run the test commands]'
'(-b --pkg-only --sdistonly)'{-b,--pkg-only,--sdistonly}'[only perform the packaging activity]'
'--installpkg[use specified package for installation into venv]:package'
'--develop[install package in development mode]'
'--no-recreate-pkg[do not recreate packaging tox environment(s)]'
'--skip-pkg-install[skip package installation for this run]'
'-e[enumerate all environments]:env'
'--skip-env[exclude all environments selected that match this regular expression]:pattern'
)
;|
(run-parallel|legacy)
options+=(
'(-p --parallel)'{-p,--parallel}'[run tox environments in parallel]:num'
'(-o --parallel-live)'{-o,--parallel-live}'[connect to stdout while running environments]'
'--parallel-no-spinner[run tox environments in parallel but do not show the spinner]'
)
;;
(config)
options+=(
'-k[list just configuration keys specified]'
'--core[show core options]'
)
;;
(schema)
options+=(
'--strict[disallow extra properties in configuration]'
)
;;
(legacy)
options+=(
'--force-dep[force a certain version of one of the dependencies]:req'
)
;;
esac
_arguments $options[@] && ret=0
;;
esac
return ret
}
(( $+functions[_tox_commands] )) ||
_tox_commands() {
local -a commands=(
'run:run environments'
'run-parallel:run environments in parallel'
'depends:visualize tox environment dependencies'
'list:list environment'
'devenv:set up a development environment at ENVDIR'
'schema:ganerate schema for tox configuration'
'config:show tox configuration'
'quickstart:quickly create a tox config file for a Python project'
'exec:execute an arbitrary command within a tox environment'
'legacy:legacy entry-point command'
)
_describe -t commands 'command' commands "$@"
}
(( $+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
}
_tox "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et