When generating completions, we use the following logic to infer the command name:
|
# FIXME: when generating completions via `python -m script completions`, |
|
# we incorrectly infer `script_name` as `__main__.py` |
|
script_name = self._io.input.script_name or inspect.stack()[-1][1] |
|
script_path = posixpath.realpath(script_name) |
|
script_name = os.path.basename(script_path) |
As stated, this doesn't work when running the script as a module via python -m:
$ poetry completions zsh | head -1
#compdef poetry
$ python -m poetry completions zsh | head -1
#compdef __main__.py
We should fix this
Note: I noticed this since Arch Linux has to work around it: https://github.com/archlinux/svntogit-community/blob/packages/python-poetry/trunk/poetry-completions-generator
When generating completions, we use the following logic to infer the command name:
cleo/cleo/commands/completions_command.py
Lines 133 to 137 in 06ba9ea
As stated, this doesn't work when running the script as a module via
python -m:We should fix this