Skip to content

autocompletion generation doesn't work #452

@cprn

Description

@cprn

Describe the bug
I noticed there's no autocompletion for protontricks in terminal, at least not on ZSH on Manjaro (I checked Bash, and it didn't work either, but I'm not sure if I did that right). I tried to generate autocompletion scripts like for any other Python project, but the resulting function initializes GUI every time I press Tab. AI claims it's because GUI initialization happens before argcomplete hooks are called in Protontricks source code.

To Reproduce
Steps to reproduce the behaviour:

  1. install argcomplete:
    yay -S python-argcomplete
    
  2. generate completion script:
    register-python-argcomplete -s zsh protontricks | sudo tee /usr/share/zsh/site-functions/_protontricks
    
  3. replace function names so they wouldn't collide with autocompletion for other Python tools:
    sudo sed -i 's/_python_/_protontricks_/g' /usr/share/zsh/site-functions/_protontricks
    
  4. re-generate completion cache:
    rm -f ~/.zcompdump*; compinit
    
  5. open fresh terminal
  6. type protontricks (with trailing space)
  7. press Tab (might need to press it twice)
  8. notice how it opens GUI

Expected behavior
Autocompletion with the list of appids for installed games, certainly not spawning windows.

System (please complete the following information):

  • Distro: Manjaro 25.1.0
  • Protontricks installation method: yay -S protontricks
  • Protontricks version: 1.13.1
  • Steam version: 1766451605 (Stable Client)

Additional context
It'd be nice to get autocompletion from argcomplete, because it would always reflect what's in the code. If you aren't interested in fixing it, though, I wrote a completion script for ZSH (it's not great, but it works) that you can straight up add to this project. If you tell me how you want to deal with Makefile and different shells, I can send a PR. Don't know how completions work in Bash, Fish, or others, so that part would have to be handled by someone else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions