pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.32k stars 1.14k forks source link

Add auto-completion for command line #9980

Open braph opened 1 month ago

braph commented 1 month ago

Current problem

Hello, I'm a happy user of pylint, but there are no auto-completion files for the shell.

Desired solution

I have created auto-completion files for bash, fish and zsh using my crazy-complete tool.

You can find the files here: https://github.com/crazy-complete/crazy-complete/tree/main/completions/pylint

The definition file was generated by parsing the output of Pylint’s --help command. A small script then enhances the file by adding the complete attribute, which defines how the argument for each option is completed.

Thanks for creating such an amazing tool!

Regards,

Benjamin Abendroth

Additional context

No response

Pierre-Sassoulas commented 1 month ago

This sounds pretty good, do you have any idea how we could integrate it in pylint directly ? (Disclaimer last time I checked was in 2018 and pylint was not using argparse yet so autocomplete was not a reasonable feature at the time so I dropped https://kislyuk.github.io/argcomplete/, but I also know very little about the topic).

braph commented 1 month ago

Hello,

I've created a pull request to add the completion files. However, I wasn’t able to test the changes in pyproject.toml myself.

Best regards, Benjamin

braph commented 1 month ago

Okay, it seems that this approach didn't work as expected. I apologize for the confusion. Perhaps these files need to be distributed by the package maintainers or system distributors instead.

Regards, Benjamin

Pierre-Sassoulas commented 1 month ago

Thank you for trying. I think if we integrate auto-completion in pylint we'll probably generate a file or do it directly inside pylint instead of parsing the output of the pylint help command with another tool. We need to do some kind of a state of the art of the solutions, maybe arg-complete is a way to do it after all (since we now use argparse internally).

braph commented 4 weeks ago

Hello, it's me again. Sorry, I don't want to be annoying, but I wanted to clarify a few things.

You wrote:

I think if we integrate auto-completion in pylint we'll probably generate a file or do it directly inside pylint instead of parsing the output of the pylint help command with another tool.

Just to clarify:

I hope this clarifies the situation. Let me know if there's anything else I can assist with!

Best regards, Benjamin