jmlopez-rod / m

A collection of devops tools
https://jmlopez-rod.github.io/m/
MIT License
1 stars 4 forks source link

Setup completions for m #86

Closed HakierGrzonzo closed 1 year ago

HakierGrzonzo commented 1 year ago

I used argcomplete to make the project capable of generating its own completions.

AFAIK, the wheel format and pypi does not allow us to ship random assets that need to be put in a specific path. Due to that, generating appropriate completions scripts and putting them in specific places will fall on the shoulders of users.

How to use completions:

Since argcomplete suggested method is unordinary, I prefer the solution presented below:

# for fish shell
register-python-argcomplete --shell fish m > /tmp/foo
sudo mv /tmp/foo /usr/share/fish/vendor_functions.d/m.fish

# for bash shell
register-python-argcomplete --shell bash m > /tmp/foo
sudo mv /tmp/foo /usr/share/bash-completion/completions/m

# for zsh
register-python-argcomplete --shell zsh m > /tmp/foo
sudo mv /tmp/foo /usr/share/zsh/site-functions/_m

This is the convention used by all packages in the arch linux repositories.