mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-04 22:51:42 +02:00
53393: Complete python module arguments
Python modules can behave like commands in their own right. This allows modules to define _python_module-* functions that are used to complete module arguments. Also gets the ball rolling by defining completions for venv, http.server, and json.tool.
This commit is contained in:
parent
1818323f45
commit
f77e469ad6
5 changed files with 46 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
|||
2025-02-28 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* Ronan Pigott: 53393: Completion/Unix/Command/_python,
|
||||
Completion/Unix/Command/_python_module-http.server,
|
||||
Completion/Unix/Command/_python_module-json.tool,
|
||||
Completion/Unix/Command/_python_module-venv:
|
||||
Complete python module arguments
|
||||
|
||||
2025-02-27 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* github #129: Vadim Misbakh-Soloviov:
|
||||
|
|
|
@ -56,6 +56,9 @@ case "$state" in
|
|||
if [[ -z "$opt_args[(I)-(c|m)]" ]]; then
|
||||
shift words
|
||||
(( CURRENT-- ))
|
||||
elif [[ -n "$opt_args[(I)-m]" ]]; then
|
||||
local ret
|
||||
_call_function ret _python_module-$opt_args[-m] && return ret
|
||||
fi
|
||||
_normal && return
|
||||
;;
|
||||
|
|
8
Completion/Unix/Command/_python_module-http.server
Normal file
8
Completion/Unix/Command/_python_module-http.server
Normal file
|
@ -0,0 +1,8 @@
|
|||
#autoload
|
||||
|
||||
_arguments -S \
|
||||
'(-h --help)'{-h,--help}'[show a help message and exit]' \
|
||||
'--cgi[run as CGI server]' \
|
||||
'(-b --bind)'{-b+,--bind=}'[bind to this address]:address:' \
|
||||
'(-d --directory)'{-d+,--directory=}'[serve this directory]:directory:_directories' \
|
||||
'(-p --protocol)'{-p+,--protocol=}'[conform to this HTTP version]:protcol version:(HTTP/1.0 HTTP/1.1)'
|
13
Completion/Unix/Command/_python_module-json.tool
Normal file
13
Completion/Unix/Command/_python_module-json.tool
Normal file
|
@ -0,0 +1,13 @@
|
|||
#autoload
|
||||
|
||||
_arguments -S \
|
||||
'(-h --help)'{-h,--help}'[show a help message and exit]' \
|
||||
'--sort-keys[sort the output of dictionaries alphabetically by key]' \
|
||||
'--no-ensure-ascii[disable escaping of non-ASCII characters]' \
|
||||
'--json-lines[parse input using the JSON Lines format]' \
|
||||
'--indent=[separate items with newlines and use this number of spaces for indentation]:spaces:' \
|
||||
'--tab[separate items with newlines and use tabs for indentation]' \
|
||||
'--no-indent[separate items with spaces rather than newlines]' \
|
||||
'--compact[suppress all whitespace separation]' \
|
||||
'1:infile:_files' \
|
||||
'2:outfile:_files'
|
14
Completion/Unix/Command/_python_module-venv
Normal file
14
Completion/Unix/Command/_python_module-venv
Normal file
|
@ -0,0 +1,14 @@
|
|||
#autoload
|
||||
|
||||
_arguments -S \
|
||||
'(-h --help)'{-h,--help}'[show a help message and exit]' \
|
||||
'--system-site-packages[give the virtual environment access to the system site-packages dir]' \
|
||||
'(--symlinks --copies)--symlinks[try to use symlinks rather than copies]' \
|
||||
'(--symlinks --copies)--copies[try to use copies rather than symlinks]' \
|
||||
'(--clear --upgrade)--clear[delete the contents of the environment directory if it already exists]' \
|
||||
'(--clear --upgrade)--upgrade[upgrade the environment directory to use this version of Python]' \
|
||||
'--without-pip[skip installing or upgrading pip]' \
|
||||
'--prompt[provides an alternative prompt prefix for the environment]' \
|
||||
'--upgrade-deps[upgrade core dependencies to the latest version]' \
|
||||
'--without-scm-ignore-files[skip adding SCM ignore files to the environment directory]'
|
||||
'*::virtual environment:_directories'
|
Loading…
Reference in a new issue