[GH-ISSUE #628] Generate shell completions #323

Closed
opened 2026-02-25 20:33:20 +03:00 by kerem · 4 comments
Owner

Originally created by @alerque on GitHub (Apr 24, 2024).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/628

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.

Originally created by @alerque on GitHub (Apr 24, 2024). Original GitHub issue: https://github.com/asciinema/asciinema/issues/628 I just started playing around with [updating the Arch Linux packaging](https://gitlab.archlinux.org/archlinux/packaging/packages/asciinema/-/merge_requests/1) 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.
kerem closed this issue 2026-02-25 20:33:20 +03:00
Author
Owner

@ku1ik commented on GitHub (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?

<!-- gh-comment-id:2074962446 --> @ku1ik commented on GitHub (Apr 24, 2024): As I also mentioned in #627 I plan to add this soon :+1: I see [clap_complete](https://docs.rs/clap_complete/latest/clap_complete/index.html) 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?
Author
Owner

@alerque commented on GitHub (Apr 24, 2024):

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

<!-- gh-comment-id:2075501398 --> @alerque commented on GitHub (Apr 24, 2024): Again, personally I much prefer build-time for this, but both ways have pros and cons.
Author
Owner

@ku1ik commented on GitHub (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/.

<!-- gh-comment-id:2083595724 --> @ku1ik commented on GitHub (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/`.
Author
Owner

@qianbinbin commented on GitHub (Jul 29, 2025):

Sorry for the interruption, I personally hope users can get man pages and shell completions without compiling.

There are several ways:

  1. obtain from binary files, for example asciinema completion bash|zsh|fish
  2. pack the files together with the binary into the release tarball
  3. get the files directly from the source code
<!-- gh-comment-id:3130799515 --> @qianbinbin commented on GitHub (Jul 29, 2025): Sorry for the interruption, I personally hope users can get man pages and shell completions without compiling. There are several ways: 1. obtain from binary files, for example `asciinema completion bash|zsh|fish` 2. pack the files together with the binary into the release tarball 3. get the files directly from the source code
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#323
No description provided.