bulletmark / pipxu

Install and Run Python Applications in Isolated Environments using UV
101 stars 1 forks source link

Add auto-completion feature by using Argcomplete #2

Closed Nardol closed 6 months ago

Nardol commented 6 months ago

This is the same method used by Pipx, it allows easilly adding shell auto-completion by only adding a few lines of code. It uses Argparse to generate auto-completion. For more information about Argcomplete, you can read the documentation.

bulletmark commented 6 months ago

Thanks for this. Very surprised I had not heard of the argcomplete package before but I will use this frequently now!

I moved your argcomplete.autocomplete() line because it should be before the config file is read. No point reading that file for every completion and it speeds it up slightly.

bulletmark commented 6 months ago

I released a new version 1.13 with this change.

bulletmark commented 6 months ago

Actually, just realized that I have used argcomplete previously in a project but that automatic PYTHON_ARGCOMPLETE_OK feature wasn't present then. Much better way to do it.