Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Complete python module arguments
- X-seq: zsh-workers 53390
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Ronan Pigott <ronan@xxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Complete python module arguments
- Date: Thu, 27 Feb 2025 16:52:43 +0100
- Archived-at: <https://zsh.org/workers/53390>
- In-reply-to: <20250225180728.17746-1-ronan@rjp.ie>
- List-id: <zsh-workers.zsh.org>
- References: <20250225180728.17746-1-ronan@rjp.ie>
Ronan Pigott wrote:
> 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, a commonly used python module.
This looks like a good idea to me.
Our usual convention on naming of completion functions tends to use a
hyphen before the name of subcommands so, e.g. _git-reset completes for
git reset while helper functions have names like _git_modified.
Submodules are more similar to subcommands so this would imply a naming
convention of, e.g. _python_module-venv
Or if the underscore / hyphen mix is too ugly, we could perhaps consider
something like _pymodule-venv or _python-venv.
On my system, python3 -m venv -h also lists --system-site-packages and
--prompt options. -h - --help is perhaps fairly ubiquitous and could
be completed even where a custom function is not found (in addition to
default file completion).
And I think _directories would be a suitable completion for 'virtual
environment'.
The convention for descriptions is not to capitalise the first word.
Can a python module name as passed to -m contain any problematic
characters such as / or any that might have a special meaning to python
. perhaps?
Thanks
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author