From 13c6b648385b550efde5bf7be4bdb97cb67dec5f Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 16 Jul 2022 20:53:59 -0700 Subject: users/27852: local _compskip to avoid propagating any changes by _normal --- Completion/Unix/Command/_python | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_python') diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index e5bac18bb..2711b8fd3 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -3,7 +3,7 @@ # Python 2.7 # Python 3.9 -local curcontext="$curcontext" state state_descr line +local curcontext="$curcontext" state state_descr line _compskip="$_compskip" typeset -A opt_args local -a args -- cgit v1.2.3 From f264fcde80a7ba2b687a1b94d567c48bbdf3423d Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 25 Jan 2023 14:48:38 +0900 Subject: 51330: Update python3 completion for version 3.11 --- ChangeLog | 5 +++++ Completion/Unix/Command/_python | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_python') diff --git a/ChangeLog b/ChangeLog index 4d18c597b..6a7af6eed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-01-27 Shohei YOSHIDA + + * 51330: Completion/Unix/Command/_python: Update python3 + completion for version 3.11 + 2023-01-24 Shohei YOSHIDA * 51326: Completion/Unix/Command/_gcc: Improve -fsanitize diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index 2711b8fd3..6e209a199 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -1,7 +1,7 @@ #compdef -P python[0-9.]# # Python 2.7 -# Python 3.9 +# Python 3.11 local curcontext="$curcontext" state state_descr line _compskip="$_compskip" typeset -A opt_args @@ -12,7 +12,11 @@ if _pick_variant python3=Python\ 3 python2 --version; then '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' '--check-hash-based-pycs[configure how Python evaluates up-to-dateness of hash-based .pyc files]:mode:(always default never)' + '--help-env[print help about Python environment variables and exit]' + '--help-xoptions[print help about implementation-specific -X options and exit]' + '--help-all[print complete help information and exit]' "-I[isolate Python from the user's environment]" + '-P[do not prepend a potentially unsafe path to sys.path]' '-q[do not print version and copyright messages]' '-X[set implementation-specific option]:option' ) -- cgit v1.2.3 From f77e469ad60973f45e1ee178f1d66686d326a75a Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Thu, 27 Feb 2025 12:01:45 -0700 Subject: 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. --- ChangeLog | 8 ++++++++ Completion/Unix/Command/_python | 3 +++ Completion/Unix/Command/_python_module-http.server | 8 ++++++++ Completion/Unix/Command/_python_module-json.tool | 13 +++++++++++++ Completion/Unix/Command/_python_module-venv | 14 ++++++++++++++ 5 files changed, 46 insertions(+) create mode 100644 Completion/Unix/Command/_python_module-http.server create mode 100644 Completion/Unix/Command/_python_module-json.tool create mode 100644 Completion/Unix/Command/_python_module-venv (limited to 'Completion/Unix/Command/_python') diff --git a/ChangeLog b/ChangeLog index cd00105cc..a2ffa1381 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-02-28 Oliver Kiddle + + * 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 * github #129: Vadim Misbakh-Soloviov: diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index 6e209a199..a5d46cfd6 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -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 ;; diff --git a/Completion/Unix/Command/_python_module-http.server b/Completion/Unix/Command/_python_module-http.server new file mode 100644 index 000000000..e5ea4a8df --- /dev/null +++ b/Completion/Unix/Command/_python_module-http.server @@ -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)' diff --git a/Completion/Unix/Command/_python_module-json.tool b/Completion/Unix/Command/_python_module-json.tool new file mode 100644 index 000000000..61c22686b --- /dev/null +++ b/Completion/Unix/Command/_python_module-json.tool @@ -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' diff --git a/Completion/Unix/Command/_python_module-venv b/Completion/Unix/Command/_python_module-venv new file mode 100644 index 000000000..1af53cc41 --- /dev/null +++ b/Completion/Unix/Command/_python_module-venv @@ -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' -- cgit v1.2.3