Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support generating shell completions #235

Merged
merged 3 commits into from
Dec 10, 2021
Merged

Conversation

orhun
Copy link
Contributor

@orhun orhun commented Dec 10, 2021

closes #232

@conradludgate
Copy link
Collaborator

Quick question, who's expected to run these shell completions and where should they be saved to? Obviously through pacman will set them up automatically I presume but what about installing directly through cargo?

@orhun
Copy link
Contributor Author

orhun commented Dec 10, 2021

Quick question, who's expected to run these shell completions and where should they be saved to? Obviously through pacman will set them up automatically I presume but what about installing directly through cargo?

This is mainly for distro packages, for example, you can install shell completions for Atuin on Arch Linux like this:

install -Dm 644 "completions/atuin.bash" "/usr/share/bash-completion/completions/atuin"
install -Dm 644 "completions/atuin.fish" -t "/usr/share/fish/vendor_completions.d"
install -Dm 644 "completions/_atuin" -t "/usr/share/zsh/site-functions"

More info: https://wiki.archlinux.org/title/Shell_package_guidelines#Shell_completions

Since they have to be placed into an appropriate location based on the current platform, I don't think they can be installed directly through cargo install.

@conradludgate
Copy link
Collaborator

I'm happy with this. Considering whether we should move to running in a build script but overall I have no real preference either way.

Thanks for your contributions, I'll wait for @ellie to take a look

@ellie ellie enabled auto-merge (squash) December 10, 2021 23:58
Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thank you! I'm happy with this. I agree with @orhun, it's up to the distro/end user to handle sorting the installation of the completion files, I think it's out of scope for something we should be thinking about

@ellie ellie merged commit 0abd063 into atuinsh:main Dec 10, 2021
@SuperSandro2000
Copy link
Contributor

How can I output the completion to stdout?

@conradludgate
Copy link
Collaborator

How can I output the completion to stdout?

You could generate them into a local or a temp dir, then cat the contents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate shell completions
4 participants