cleo icon indicating copy to clipboard operation
cleo copied to clipboard

completions: support generation when running as module

Open branchv opened this issue 3 years ago • 0 comments

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

branchv avatar Aug 03 '22 22:08 branchv