cleo
cleo copied to clipboard
completions: support generation when running as module
When generating completions, we use the following logic to infer the command name: https://github.com/python-poetry/cleo/blob/06ba9ea40488fad28446b764e4c9ea3a29cb4982/cleo/commands/completions_command.py#L133-L137
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