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

Generate shell completions #628

Closed
alerque opened this issue Apr 24, 2024 · 3 comments
Closed

Generate shell completions #628

alerque opened this issue Apr 24, 2024 · 3 comments

Comments

@alerque
Copy link

alerque commented Apr 24, 2024

I just started playing around with updating the Arch Linux packaging in preparation for the v3 release.

Given that the Rust rewrite is using Clap, it should be pretty trivial to generate shell completions for Bash, Zsh, Fish, Elvish, and Powershell should be pretty trivial using clap_completions. This is a nice user convenience to have and makes the most sense in the context of distro packages where they would get automatically installed to the right places automatically.

There is not reason this has to make the final v3 cut, but I figured whether early or late a tracking issue is warranted so downstream packages know if it is or isn't available and how it is generated.

@ku1ik
Copy link
Contributor

ku1ik commented Apr 24, 2024

As I also mentioned in #627 I plan to add this soon 👍

I see clap_complete supports generation both at compile-time and run-time, so we have options here as wells. Initially I thought runtime generation would be most useful, especially for people who download standalone precompiled binaries. Runtime generation can also be used to generate completion files for packages (by redirecting the output to completion files in proper paths within a package dir tree). Although, we could have both, doesn't seem too hard.

Thoughts?

@alerque
Copy link
Author

alerque commented Apr 24, 2024

Again, personally I much prefer build-time for this, but both ways have pros and cons.

@ku1ik ku1ik closed this as completed in 39d46c0 Apr 29, 2024
@ku1ik
Copy link
Contributor

ku1ik commented Apr 29, 2024

You can now generate shell completions during build by setting ASCIINEMA_GEN_DIR env var - the files will be saved in $ASCIINEMA_GEN_DIR/completion/.

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

No branches or pull requests

2 participants