mvt icon indicating copy to clipboard operation
mvt copied to clipboard

Add shell-completion commands

Open nimrod-a opened this issue 1 year ago • 4 comments

This PR is a WIP to add a shell-completion command to mvt-ios and mvt-android.

As discussed in #589, there is currently no suitable library to implement this feature without substantial performance impact.

I have therefor created a modified fork of the most popular click autocomplete library (auto-click-auto), which I named quick-click-auto.

You can read more about it here

It still needs some working on, but will hopefully do its job in the near future. I will give an update once I have done some more testing!

nimrod-a avatar Jan 15 '25 18:01 nimrod-a

Update:

The shell-completion command should work as expected now! I would be happy about people testing this feature :)

For testing:

git clone -b feature/command_completion_command https://github.com/nimrod-a/mvt.git \
&& cd mvt \
&& python3 -m venv .venv && source .venv/bin/activate \
&& pip install . \
&& mvt-ios shell-completion # or mvt-android

Then reopen the terminal or run a new with bash or `zsh. Command completion should be enabled now.

It works by:

  • Generating the command completion scripts
  • Editing the shell configuration to automatically sources the generated files to the shell.

It should not slow down shell responsiveness as much as the eval implementation did, as the scripts are not generated every time the shell is opened.

nimrod-a avatar Jan 24 '25 17:01 nimrod-a

Hey @nimrod-a if this is done and ready for review could you remove the "WIP" in the title? Could someone review this? @Te-k @roaree ?

besendorf avatar Jun 20 '25 09:06 besendorf

I am happy to review that when it is done (and when I will have time, may take a week or two). One question we may have is do we want to have another dependency for that feature? and is this library going to be maintained if it was forked just for this project?

Te-k avatar Jun 20 '25 09:06 Te-k

Hey! Sorry for the late reply. You / @roaree & @DonnchaC probably know better then me if having another dependency is worth it for the feature. I can say that for me as a beginner MVT user it was quite useful.

Regrading maintenance of the library: since quick-click-auto has no 3rd party dependencies besides Click, it will most likely only need modification in case Click changes its Shell Completion implementation, which should not happen too often. I am quite busy with writing my thesis right now, but once I'm done I plan to make a few PRs for command completion at other projects which utilize Click, so the library will hopefully not be used only for MVT.

nimrod-a avatar Jul 13 '25 12:07 nimrod-a