zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _python: add missing options
@ 2021-07-26 22:10 Štěpán Němec
  2021-07-28  3:42 ` Matthew Martin
  0 siblings, 1 reply; 3+ messages in thread
From: Štěpán Němec @ 2021-07-26 22:10 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_python | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python
index f10106f9b4d9..05d26f2e7652 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.4
+# Python 3.9
 
 local curcontext="$curcontext" state state_descr line
 typeset -A opt_args
@@ -11,7 +11,9 @@ if _pick_variant python3=Python\ 3 python2 --version; then
   args=(
     '(-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'
     "-I[isolate Python from the user's environment]"
+    '-q[do not print version and copyright messages]'
     '-X[set implementation-specific option]:option'
   )
 else
@@ -37,7 +39,8 @@ _arguments -C -s -S "$args[@]" \
   "-s[don't add user site directory to sys.path]" \
   "-S[don't imply 'import site' on initialization]" \
   '-u[unbuffered binary stdout and stderr]' \
-  '-v[verbose (trace import statements)]' \
+  '(-vv)-v[trace module initialization and cleanup]' \
+  '(-v)-vv[in addition to -v, trace all files checked when searching for a module]' \
   '(1 * -)-V[display version information]' \
   '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
   '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \

base-commit: f8ec33c453159ad848d9b1a28782c5df7f0cc944
-- 
2.32.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] _python: add missing options
  2021-07-26 22:10 [PATCH] _python: add missing options Štěpán Němec
@ 2021-07-28  3:42 ` Matthew Martin
  2021-08-03 17:36   ` [PATCH v2] " Štěpán Němec
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Martin @ 2021-07-28  3:42 UTC (permalink / raw)
  To: zsh-workers

On Tue, Jul 27, 2021 at 12:10:50AM +0200, Štěpán Němec wrote:
> ---
>  Completion/Unix/Command/_python | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python
> index f10106f9b4d9..05d26f2e7652 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.4
> +# Python 3.9
>  
>  local curcontext="$curcontext" state state_descr line
>  typeset -A opt_args
> @@ -11,7 +11,9 @@ if _pick_variant python3=Python\ 3 python2 --version; then
>    args=(
>      '(-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'

Should probably offer the allowed modes here
    '--check-hash-based-pycs[configure how Python evaluates up-to-dateness of hash-based .pyc files]:mode:(default always never)'

>      "-I[isolate Python from the user's environment]"
> +    '-q[do not print version and copyright messages]'
>      '-X[set implementation-specific option]:option'
>    )
>  else
> @@ -37,7 +39,8 @@ _arguments -C -s -S "$args[@]" \
>    "-s[don't add user site directory to sys.path]" \
>    "-S[don't imply 'import site' on initialization]" \
>    '-u[unbuffered binary stdout and stderr]' \
> -  '-v[verbose (trace import statements)]' \
> +  '(-vv)-v[trace module initialization and cleanup]' \
> +  '(-v)-vv[in addition to -v, trace all files checked when searching for a module]' \

--help only mentions "can be supplied multiple times to increase
verbosity" not what each count does. I'm not sure we should be more
specific than the --help output. Changing the spec to *-v may suffice.

>    '(1 * -)-V[display version information]' \
>    '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
>    '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
> 
> base-commit: f8ec33c453159ad848d9b1a28782c5df7f0cc944
> -- 
> 2.32.0
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] _python: add missing options
  2021-07-28  3:42 ` Matthew Martin
@ 2021-08-03 17:36   ` Štěpán Němec
  0 siblings, 0 replies; 3+ messages in thread
From: Štěpán Němec @ 2021-08-03 17:36 UTC (permalink / raw)
  To: zsh-workers

---

The only difference from v1 is addition of the 'mode' argument
completion to the --check-hash-based-pycs option.

Response to Matthew's comments follows inline.

On Tue, 27 Jul 2021 22:42:13 -0500
Matthew Martin wrote:

> On Tue, Jul 27, 2021 at 12:10:50AM +0200, Štěpán Němec wrote:
>> diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python
>> index f10106f9b4d9..05d26f2e7652 100644
>> --- a/Completion/Unix/Command/_python
>> +++ b/Completion/Unix/Command/_python
>> @@ -11,7 +11,9 @@ if _pick_variant python3=Python\ 3 python2 --version; then
>>    args=(
>>      '(-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'
>
> Should probably offer the allowed modes here
>     '--check-hash-based-pycs[configure how Python evaluates up-to-dateness of hash-based .pyc files]:mode:(default always never)'

Now added.

>> @@ -37,7 +39,8 @@ _arguments -C -s -S "$args[@]" \
>>    "-s[don't add user site directory to sys.path]" \
>>    "-S[don't imply 'import site' on initialization]" \
>>    '-u[unbuffered binary stdout and stderr]' \
>> -  '-v[verbose (trace import statements)]' \
>> +  '(-vv)-v[trace module initialization and cleanup]' \
>> +  '(-v)-vv[in addition to -v, trace all files checked when searching for a module]' \
>
> --help only mentions "can be supplied multiple times to increase
> verbosity" not what each count does. I'm not sure we should be more
> specific than the --help output. Changing the spec to *-v may suffice.

Manual pages of both Python major versions as well as the online docs
[1] are quite explicit about the function and number of repetitions [2]
of the -v option, so I still believe being explicit in the completion as
well is more correct and helpful.

Thank you.

[1] https://docs.python.org/3/using/cmdline.html#id4

[2] Also confirmed by a simple test:

% python -v 2>&1 </dev/null | wc -l
364
% python -vv 2>&1 </dev/null | wc -l
1832
% python -vvv 2>&1 </dev/null | wc -l
1832
% python -vvvv 2>&1 </dev/null | wc -l
1832

 Completion/Unix/Command/_python | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python
index f10106f9b4d9..e5bac18bb4d7 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.4
+# Python 3.9
 
 local curcontext="$curcontext" state state_descr line
 typeset -A opt_args
@@ -11,7 +11,9 @@ if _pick_variant python3=Python\ 3 python2 --version; then
   args=(
     '(-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)'
     "-I[isolate Python from the user's environment]"
+    '-q[do not print version and copyright messages]'
     '-X[set implementation-specific option]:option'
   )
 else
@@ -37,7 +39,8 @@ _arguments -C -s -S "$args[@]" \
   "-s[don't add user site directory to sys.path]" \
   "-S[don't imply 'import site' on initialization]" \
   '-u[unbuffered binary stdout and stderr]' \
-  '-v[verbose (trace import statements)]' \
+  '(-vv)-v[trace module initialization and cleanup]' \
+  '(-v)-vv[in addition to -v, trace all files checked when searching for a module]' \
   '(1 * -)-V[display version information]' \
   '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
   '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \

base-commit: 765bc1470197fa76b74e58b878ed406745234518
-- 
2.32.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-03 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 22:10 [PATCH] _python: add missing options Štěpán Němec
2021-07-28  3:42 ` Matthew Martin
2021-08-03 17:36   ` [PATCH v2] " Štěpán Němec

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).